Module MrMime_input

module MrMime_input: sig .. end
Module Input

type 'a t = 'a RingBuffer.Committed.t 
A ringbuffer.
type st = Internal_buffer.st = 
| St (*
A proof to use a (char, int8_unsigned_elt, c_layout) Bigarray.Array1.t
*)
A proof to use a string internally
type bs = Internal_buffer.bs = 
| Bs
val write : 'a t -> 'a Internal_buffer.t -> int -> int -> unit
write input buf off len writes an internal buffer (with the same proof 'a - see MrMime_input.st or MrMime_input.bs) starting at off to len inside the input.
val write_string : 'a t -> string -> int -> int -> unit
write_string input buf off len writes a string starting at off to len inside the input.
val create_bytes : int -> st t
create_bytes size returns a fresh input of length size with the proof MrMime_input.st. The sequence is uninitialiazed and contains arbitrary bytes.
val create_bigstring : int -> bs t
create_bigstring size returns a fresh input of length size with the proof MrMime_input.bs. The sequence is unintialiazed and contains arbitrary bytes.
val size : 'a t -> int
size input returns the length of the given input.
val peek : 'a t -> 'a Internal_buffer.t -> int -> int -> unit
peek input buf off len same as MrMime_input.read but does not advance the read pointer.
val read : 'a t -> 'a Internal_buffer.t -> int -> int -> unit
read input buf off len read the data inside the input and advance the read pointer.
val read_space : 'a t -> ('a Internal_buffer.t * int * int) option
read_space input returns a continuous part of the internal buffer with the offset and the length of bytes available to read. If MrMime_input.ravailable returns 0, read_space returns None.

The continuous part of the internal buffer is not necessarily a buffer which contains all bytes available to read (it's a part).

val write_space : 'a t -> ('a Internal_buffer.t * int * int) option
write_space input returns a continuous part of the internal buffer with the offset and the length of bytes available to write. If MrMime_input.wavailable returns 0, write_space returns None.

The continuous part of the internal buffer is not necessarily a buffer which contains all bytes available to write (it's a part).

val transmit : 'a t -> ('a Internal_buffer.t -> int -> int -> int) -> int
transmit input f same as Option.map f (read_space input).
val ravailable : 'a t -> int
ravailable input returns available bytes to read.
val wavailable : 'a t -> int
wavailable input returns available bytes to write.
val radvance : 'a t -> int -> unit
radvance input n drops n bytes.
val wadvance : 'a t -> int -> unit
wadvance input n advances the write pointer.
val get : 'a t -> char
get input gets the first character at the read pointer.
val pp : Format.formatter -> 'a t -> unit
pp input prints an human readable representation of input.
val proof : 'a t -> 'a Internal_buffer.t
proof input gets the internal buffer with the proof.
val savailable : 'a t -> int
savailable input returns available bytes to read or, if the input is committed, returns available bytes from the commit to the write pointer.