Struct arrow2::offset::Offsets

source ·
pub struct Offsets<O: Offset>(_);
Expand description

A wrapper type of Vec<O> representing the invariants of Arrow’s offsets. It is guaranteed to (sound to assume that):

  • every element is >= 0
  • element at position i is >= than element at position i-1.

Implementations§

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

Returns an Offsets whose all lengths are zero.

Creates a new Offsets from an iterator of lengths

Returns a new Offsets with a capacity, allocating at least capacity + 1 entries.

Returns the capacity of Offsets.

Reserves additional entries.

Shrinks the capacity of self to fit.

Pushes a new element with a given length.

Error

This function errors iff the new last item is larger than what O supports.

Panic

This function asserts that length > 0.

Pushes a new element with a given length.

Error

This function errors iff the new last item is larger than what O supports.

Implementation

This function:

  • checks that this length does not overflow

Returns Offsets assuming that offsets fulfills its invariants

Safety

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

Returns the last offset of this container.

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 the length an array with these offsets would be.

Returns the number of offsets in this container.

Returns the byte slice stored in this buffer

Pops the last element

Extends itself with additional elements equal to the last offset. This is useful to extend offsets with empty values, e.g. for null slots.

Try to create a new Offsets from a sequence of lengths

Errors

This function errors iff this operation overflows for the maximum value of O.

Try extend from an iterator of lengths

Errors

This function errors iff this operation overflows for the maximum value of O.

Extends itself from another Offsets

Errors

This function errors iff this operation overflows for the maximum value of O.

Extends itself from another Offsets sliced by start, length

Errors

This function errors iff this operation overflows for the maximum value of O.

Returns the inner Vec.

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.

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
Compare self to key and return true if they are equal.

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.