pub struct OffsetsBuffer<O: Offset>(_);
Expand description

A wrapper type of Buffer<O> that is guaranteed to:

  • Always contain an element
  • Every element is >0
  • element at position i is >= than element at position i-1.

Implementations§

Safety

This is safe iff the invariants of this struct are guaranteed in offsets.

Returns an empty OffsetsBuffer (i.e. with a single element, the zero)

Copy-on-write API to convert OffsetsBuffer into Offsets.

Returns a reference to its internal Buffer.

Returns the length of this container

Returns the byte slice stored in this buffer

Returns the last offset of this container, which is guaranteed to exist.

Returns a range (start, end) corresponding to the position index

Panic

This function panics iff index >= self.len()

Returns a range (start, end) corresponding to the position index

Safety

index must be < self.len()

Returns a new OffsetsBuffer that is a slice of this buffer starting at offset. Doing so allows the same memory region to be shared between buffers.

Safety

The caller must ensure offset + length <= self.len()

Returns an iterator with the lengths of the offsets

Returns the inner Buffer.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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.
The type returned in the event of a conversion error.
Performs the conversion.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.