mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 11:15:35 -05:00
add IO.Out_channel.of_buffer
This commit is contained in:
parent
355cc4d004
commit
29de702c55
1 changed files with 5 additions and 0 deletions
|
|
@ -79,6 +79,11 @@ module Out_channel = struct
|
||||||
close_out oc);
|
close_out oc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(** [of_buffer buf] is an output channel that writes directly into [buf].
|
||||||
|
[flush] and [close] have no effect. *)
|
||||||
|
let of_buffer (buf : Buffer.t) : t =
|
||||||
|
{ output = Buffer.add_subbytes buf; flush = ignore; close = ignore }
|
||||||
|
|
||||||
(** Output the buffer slice into this channel *)
|
(** Output the buffer slice into this channel *)
|
||||||
let[@inline] output (self : t) buf i len : unit = self.output buf i len
|
let[@inline] output (self : t) buf i len : unit = self.output buf i len
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue