Tiny_httpd_io.Output
Output channel (byte sink)
type t = {
output_char : char -> unit;
Output a single char
*)output : bytes -> int -> int -> unit;
Output slice
*)flush : unit -> unit;
Flush underlying buffer
*)close : unit -> unit;
Close the output. Must be idempotent.
*)}
An output channel, ie. a place into which we can write bytes.
This can be a Buffer.t
, an out_channel
, a Unix.file_descr
, etc.
val of_out_channel : ?close_noerr:bool -> Stdlib.out_channel -> t
of_out_channel oc
wraps the channel into a Output.t
.
val of_buffer : Stdlib.Buffer.t -> t
of_buffer buf
is an output channel that writes directly into buf
. flush
and close
have no effect.
val output_char : t -> char -> unit
Output the buffer slice into this channel
val output : t -> bytes -> int -> int -> unit
Output the buffer slice into this channel
val output_string : t -> string -> unit
val close : t -> unit
Close the channel.
val flush : t -> unit
Flush (ie. force write) any buffered bytes.