pub struct Offsets<O: Offset>(/* private fields */);
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 positioni-1
.
Implementations§
source§impl<O: Offset> Offsets<O>
impl<O: Offset> Offsets<O>
sourcepub fn new_zeroed(length: usize) -> Self
pub fn new_zeroed(length: usize) -> Self
Returns an Offsets
whose all lengths are zero.
sourcepub fn try_from_iter<I: IntoIterator<Item = usize>>(
iter: I
) -> Result<Self, Error>
pub fn try_from_iter<I: IntoIterator<Item = usize>>( iter: I ) -> Result<Self, Error>
Creates a new Offsets
from an iterator of lengths
sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Returns a new Offsets
with a capacity, allocating at least capacity + 1
entries.
sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of self to fit.
sourcepub unsafe fn new_unchecked(offsets: Vec<O>) -> Self
pub unsafe fn new_unchecked(offsets: Vec<O>) -> Self
sourcepub fn start_end(&self, index: usize) -> (usize, usize)
pub fn start_end(&self, index: usize) -> (usize, usize)
Returns a range (start, end) corresponding to the position index
§Panic
This function panics iff index >= self.len()
sourcepub unsafe fn start_end_unchecked(&self, index: usize) -> (usize, usize)
pub unsafe fn start_end_unchecked(&self, index: usize) -> (usize, usize)
sourcepub fn extend_constant(&mut self, additional: usize)
pub fn extend_constant(&mut self, additional: usize)
Extends itself with additional
elements equal to the last offset.
This is useful to extend offsets with empty values, e.g. for null slots.
sourcepub fn try_extend_from_lengths<I: Iterator<Item = usize>>(
&mut self,
lengths: I
) -> Result<(), Error>
pub fn try_extend_from_lengths<I: Iterator<Item = usize>>( &mut self, lengths: I ) -> Result<(), Error>
Try extend from an iterator of lengths
§Errors
This function errors iff this operation overflows for the maximum value of O
.
sourcepub fn try_extend_from_slice(
&mut self,
other: &OffsetsBuffer<O>,
start: usize,
length: usize
) -> Result<(), Error>
pub fn try_extend_from_slice( &mut self, other: &OffsetsBuffer<O>, start: usize, length: usize ) -> Result<(), Error>
sourcepub fn into_inner(self) -> Vec<O>
pub fn into_inner(self) -> Vec<O>
Returns the inner Vec
.
Trait Implementations§
source§impl<O: PartialEq + Offset> PartialEq for Offsets<O>
impl<O: PartialEq + Offset> PartialEq for Offsets<O>
impl<O: Eq + Offset> Eq for Offsets<O>
impl<O: Offset> StructuralPartialEq for Offsets<O>
Auto Trait Implementations§
impl<O> Freeze for Offsets<O>
impl<O> RefUnwindSafe for Offsets<O>where
O: RefUnwindSafe,
impl<O> Send for Offsets<O>
impl<O> Sync for Offsets<O>
impl<O> Unpin for Offsets<O>where
O: Unpin,
impl<O> UnwindSafe for Offsets<O>where
O: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more