Page
Library
Module
Module type
Parameter
Class
Class type
Source
Pbrt.Encoder
SourceEncoding protobufs.
Clear the content of the internal buffer(s), but does not release memory. This makes the encoder ready to encode another message.
Clears the content and resets internal storage to its initial memory consumption.
This is more costly than clear
but can be useful after a very large message was encoded.
Extract the content of the encoder to a string. Call this after encoding a message into the encoder.
write_chunks w e
calls the write function w
(e.g output oc
for some output channel oc
) on every chunk inside e
. The number of chunks is an implementation detail.
These combinators are used by generated code (or user combinators) to encode a OCaml value into the wire representation of protobufs.
key k pk e
writes a key and a payload kind to e
.
nested f x e
applies f x
to an encoder for a message nested in e
.
val map_entry :
encode_key:('a -> t -> unit) ->
encode_value:('b -> t -> unit) ->
(('a * payload_kind) * ('b * payload_kind)) ->
t ->
unit
int_as_zigzag i e
encodes i
in e
with Varint
zigzag encoding
int32_as_varint i e
encodes i
in e
with Varint
encoding
int32_as_varint i e
encodes i
in e
with Varint
zigzag encoding
int64_as_varint i e
encodes i
in e
with Varint
encoding
int64_as_varint i e
encodes i
in e
with Varint
zigzag encoding
int32_as_varint i e
encodes i
in e
with Bits32
encoding
int64_as_varint i e
encodes i
in e
with Bits64
encoding
float_as_bits32 f e
encodes f
in e
with Bits32
encoding
float_as_bits64 f e
encodes f
in e
with Bits64
encoding
int_as_bits32 i e
encodes i
in e
with Bits32
encoding TODO : add error handling