The type for write errors.
val pp_write_error : write_error Fmt.tpp_write_error is the pretty-printer for write errors.
create flow allocates send and receive buffers and associates them with the given unbuffered flow.
val read_char : t -> (char Mirage_flow.or_eof, error) Stdlib.result Lwt.tReads a single character from the channel, blocking if there is no immediately available input data.
val read_some : ?len:int -> t -> (Cstruct.t Mirage_flow.or_eof, error) Stdlib.result Lwt.tread_some ?len t reads up to len characters from the input channel and at most a full buffer. If len is not specified, it reads all available data and returns that buffer.
val read_exactly : len:int -> t -> (Cstruct.t list Mirage_flow.or_eof, error) Stdlib.result Lwt.tread_exactly len t reads len bytes from the channel t or fails with Eof.
val read_line : t -> (Cstruct.t list Mirage_flow.or_eof, error) Stdlib.result Lwt.tread_line t reads a line of input, which is terminated either by a CRLF sequence, or the end of the channel (which counts as a line).
- returns
Returns a list of views that terminates at EOF.
val write_char : t -> char -> unitwrite_char t ch writes a single character to the output channel.
val write_string : t -> string -> int -> int -> unitwrite_string t buf off len writes len bytes from a string buf, starting from from offset off.
write_buffer t buf copies the buffer to the channel's output buffer. The buffer should not be modified after being written, and it will be recycled into the buffer allocation pool at some future point.
val write_line : t -> string -> unitwrite_line t buf writes the string buf to the output channel and append a newline character afterwards.
val flush : t -> (unit, write_error) Stdlib.result Lwt.tflush t flushes the output buffer and block if necessary until it is all written out to the flow.
val close : t -> (unit, write_error) Stdlib.result Lwt.tclose t calls flush and then close the underlying flow.