Struct capnp::serialize::SegmentLengthsBuilder [−][src]
pub struct SegmentLengthsBuilder { /* fields omitted */ }
Expand description
Helper object for constructing an OwnedSegments
or a SliceSegments
.
Implementations
Creates a new SegmentsLengthsBuilder
, initializing the segment_indices vector with
Vec::with_capacitiy(capacity)
. capacity
should equal the number of times that push_segment()
is expected to be called.
Pushes a new segment length. The n
th time (starting at 0) this is called specifies the length of
the segment with ID n
.
Constructs an OwnedSegments
, allocating a single buffer of 8-byte aligned memory to hold
all segments.
Constructs a SliceSegments
, where the passed-in slice is assumed to contain the segments.
Returns the sum of the lengths of the segments pushed so far.