Library
Module
Module type
Parameter
Class
Class type
Farfadet module.
type 'a t = Faraday.t -> 'a -> unit
A writer. It's a function which takes the Faraday's encoder, a value 'a
and write the value in the encoder.
val beint16 : int t
Writer of a 16-bits integer in big-endian order.
val beint32 : int32 t
Writer of a 16-bits integer in big-endian order.
Writer of a 32-bits integer in big-endian order.
val beint64 : int64 t
Writer of a 32-bits integer in big-endian order.
Writer of a 64-bits integer in big-endian order.
val leint16 : int t
Writer of a 64-bits integer in big-endian order.
Writer of a 16-bits integer in little-endian order.
val leint32 : int32 t
Writer of a 16-bits integer in little-endian order.
Writer of a 32-bits integer in little-endian order.
val leint64 : int64 t
Writer of a 32-bits integer in little-endian order.
Writer of a 64-bits integer in little-endian order.
val string : string t
Writer of a string
.
val bigstring : Faraday.bigstring t
Writer of a Bytes.t
.
Writer of a Faraday.bigstring
.
val bool : bool t
Writer of a bool
. If the value is true
, the writer writes '1'
, otherwise, it writes '0'
.
val char : char t
Writer of a bool
. If the value is true
, the writer writes '1'
, otherwise, it writes '0'
.
Writer of a char
.
seq a b
composes 2 writers to one. It writes a
, then b
.
option a
makes a new writer and expects an option value. If the valus is None
, nothing happens. Otherwise, we call the writer a
.
option a
makes a new writer and expects an option value. If the valus is None
, nothing happens. Otherwise, we call the writer a
.
list ~sep a
makes a new writer and expects a list of value (which have the type a
). list ~sep a
writes each value with the writer a
interspersed by the writer sep
.
comap a f
makes a writer which runs f
with the value and pass its results to a
.
Operations on slices
type 'a sub = Faraday.t -> ?off:int -> ?len:int -> 'a -> unit
A sub-writer with optional arguments off
and len
to specify which slice need to be written.
val substring : string sub
Writer of a sub-string
.
val subbytes : bytes sub
Writer of a sub-string
.
Writer of a sub-Bytes.t
.
val subbigstring : Faraday.bigstring sub
Writer of a sub-Bytes.t
.
Writer of a sub-Faraday.bigstring
.
val blitter :
('a -> int) ->
('a -> src_off:int -> Faraday.bigstring -> dst_off:int -> len:int -> unit) ->
'a sub
Writer of a sub-Faraday.bigstring
.
blitter len blit
makes a new sub-writer which uses the specific blit
function to blit the value to the internal Faraday.bigstring
and the specific length
function to get the length of the value 'a
(used when the optional argument len = None
).
eg. If you want to use a memcpy
implementation instead a standalone memmove
implementation.
A record which contains the optional values off
and len
.
Formatters
atom writer
makes a new order
to apply the writer
to the Faraday's encoder.
val yield : ('v, 'v) order
concat fmt1 fmt2
concats fmt1
with fmt2
.
yield
orders a Faraday.yield
operations to the Faraday's encoder.
val flush : (unit -> unit) -> ('v, 'v) order
yield
orders a Faraday.yield
operations to the Faraday's encoder.
flush f
registers f
to be called when all prior writes have been successfully completed to the Faraday's encoder.
Constants
const kind value
calls the writer kind
with the value value
directly.
const kind value
calls the writer kind
with the value value
directly.
Infix operator of const
.
Conveniences operations
module Const : sig ... end
module Sched : sig ... end