Commits

Dmitry Grebeniuk  committed 24ddd9a

+ Iteratees.gather_to_string

  • Participants
  • Parent commits 55d0944

Comments (0)

Files changed (1)

File iteratees.ml

 ;
 
 
+value gather_to_string : iteratee char string =
+  prepend
+    (fun () -> Buffer.create 50)
+    (fun buf ->
+       ie_cont step
+       where rec step s =
+         match s with
+         [ Chunk c ->
+             ( Subarray.buffer_add buf c ; ie_contM step )
+         | EOF None ->
+             ie_doneM (Buffer.contents buf) s
+         | EOF (Some e) ->
+             IO.error e
+         ]
+    )
+;
+
+
 end
 ;  (* `Make' functor *)