mirror of
https://github.com/ocaml-multicore/eio.git
synced 2025-07-20 00:01:05 -04:00
Compare commits
No commits in common. "ee51b04408f0ddddd3a3ef3285ad39da89e385fd" and "669c2e86c0462540618a6d1c7974d561b0e002bb" have entirely different histories.
ee51b04408
...
669c2e86c0
@ -12,13 +12,8 @@ module Lazy = Lazy
|
||||
module Pool = Pool
|
||||
module Exn = Exn
|
||||
module Resource = Resource
|
||||
module Flow = Flow
|
||||
module Buf_read = Buf_read
|
||||
module Flow = struct
|
||||
include Flow
|
||||
|
||||
let read_all flow =
|
||||
Buf_read.(parse_exn take_all) flow ~max_size:max_int
|
||||
end
|
||||
module Buf_write = Buf_write
|
||||
module Net = Net
|
||||
module Process = Process
|
||||
|
@ -60,16 +60,7 @@ module Std = Std
|
||||
module Resource = Resource
|
||||
|
||||
(** Byte streams. *)
|
||||
module Flow : sig
|
||||
include module type of Flow (** @inline *)
|
||||
|
||||
(** {2 Convenience wrappers} *)
|
||||
|
||||
val read_all : _ source -> string
|
||||
(** [read_all src] is a convenience wrapper to read an entire flow.
|
||||
|
||||
It is the same as [Buf_read.(parse_exn take_all) src ~max_size:max_int] *)
|
||||
end
|
||||
module Flow = Flow
|
||||
|
||||
(** Buffered input and parsing *)
|
||||
module Buf_read = Buf_read
|
||||
|
@ -241,8 +241,7 @@ Exception: End_of_file.
|
||||
|
||||
```ocaml
|
||||
# let bflow = R.of_flow mock_flow ~max_size:100 |> R.as_flow;;
|
||||
val bflow : Eio__Flow.source_ty Eio.Std.r =
|
||||
Eio__.Resource.T (<poly>, <abstr>)
|
||||
val bflow : Eio.Flow.source_ty Eio.Std.r = Eio__.Resource.T (<poly>, <abstr>)
|
||||
# next := ["foo"; "bar"]; read bflow 2;;
|
||||
+mock_flow returning 3 bytes
|
||||
+Read "fo"
|
||||
|
@ -108,22 +108,6 @@ Copying from src using `Read_source_buffer`:
|
||||
- : unit = ()
|
||||
```
|
||||
|
||||
## read_all
|
||||
|
||||
```ocaml
|
||||
# run @@ fun () ->
|
||||
let each = String.init 256 Char.chr in
|
||||
let data = List.init 40 (fun _ -> Cstruct.of_string each) in
|
||||
let got = Eio.Flow.read_all (mock_source data) in
|
||||
traceln "Input length: %d\nOutput length: %d\nEqual: %b"
|
||||
(Cstruct.lenv data) (String.length got) (String.equal got (Cstruct.copyv data));
|
||||
;;
|
||||
+Input length: 10240
|
||||
+Output length: 10240
|
||||
+Equal: true
|
||||
- : unit = ()
|
||||
```
|
||||
|
||||
## write
|
||||
|
||||
```ocaml
|
||||
|
Loading…
x
Reference in New Issue
Block a user