Helper object for constructing an
OwnedSegments or a
pub fn with_capacity(capacity: usize) -> Self[src]
Creates a new
SegmentsLengthsBuilder, initializing the segment_indices vector with
capacity should equal the number of times that
is expected to be called.
pub fn push_segment(&mut self, length_in_words: usize)[src]
Pushes a new segment length. The
nth time (starting at 0) this is called specifies the length of
the segment with ID
pub fn into_owned_segments(self) -> OwnedSegments[src]
OwnedSegments, allocating a single buffer of 8-byte aligned memory to hold
pub fn into_slice_segments(self, slice: &[u8]) -> SliceSegments[src]
SliceSegments, where the passed-in slice is assumed to contain the segments.
pub fn total_words(&self) -> usize[src]
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
impl RefUnwindSafe for SegmentLengthsBuilder
impl Send for SegmentLengthsBuilder
impl Sync for SegmentLengthsBuilder
impl Unpin for SegmentLengthsBuilder
impl UnwindSafe for SegmentLengthsBuilder
type Error = Infallible
The type returned in the event of a conversion error.