let string_to_item () =
let buf = Buffer.make () in
Biocaml_transform.make ~name:"string_to_lines"
~feed:(Buffer.feed_string buf)
~next:(function
| true -> (match Buffer.next_line buf with
| Some line -> `output line
| None -> (match Buffer.contents buf with
| [], None -> `end_of_stream
| [], Some unfinished_line ->
(Buffer.empty buf; `output (Line.of_string_unsafe unfinished_line))
| _ -> assert false
)
)
| false -> (match Buffer.next_line buf with
| None -> `not_ready
| Some line -> `output line
)
)
()