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 nth 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.

Returns the vector of segment indices. Each entry is a pair (start_word_index, end_word_index). This method primarily exists to enable testing.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.