Struct arrow2::offset::OffsetsBuffer
source · pub struct OffsetsBuffer<O: Offset>(/* private fields */);
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 positioni-1
.
Implementations§
source§impl<O: Offset> OffsetsBuffer<O>
impl<O: Offset> OffsetsBuffer<O>
sourcepub unsafe fn new_unchecked(offsets: Buffer<O>) -> Self
pub unsafe fn new_unchecked(offsets: Buffer<O>) -> Self
§Safety
This is safe iff the invariants of this struct are guaranteed in offsets
.
sourcepub fn new() -> Self
pub fn new() -> Self
Returns an empty OffsetsBuffer
(i.e. with a single element, the zero)
sourcepub fn get_mut(&mut self) -> Option<Offsets<O>>
pub fn get_mut(&mut self) -> Option<Offsets<O>>
Copy-on-write API to convert OffsetsBuffer
into Offsets
.
sourcepub fn last(&self) -> &O
pub fn last(&self) -> &O
Returns the last offset of this container, which is guaranteed to exist.
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 unsafe fn slice_unchecked(self, offset: usize, length: usize) -> Self
pub unsafe fn slice_unchecked(self, offset: usize, length: usize) -> Self
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()
sourcepub fn lengths(&self) -> impl Iterator<Item = usize> + '_
pub fn lengths(&self) -> impl Iterator<Item = usize> + '_
Returns an iterator with the lengths of the offsets
sourcepub fn into_inner(self) -> Buffer<O>
pub fn into_inner(self) -> Buffer<O>
Returns the inner Buffer
.
Trait Implementations§
source§impl<O: Clone + Offset> Clone for OffsetsBuffer<O>
impl<O: Clone + Offset> Clone for OffsetsBuffer<O>
source§fn clone(&self) -> OffsetsBuffer<O>
fn clone(&self) -> OffsetsBuffer<O>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<O: Offset> Default for OffsetsBuffer<O>
impl<O: Offset> Default for OffsetsBuffer<O>
source§impl From<&OffsetsBuffer<i32>> for OffsetsBuffer<i64>
impl From<&OffsetsBuffer<i32>> for OffsetsBuffer<i64>
source§fn from(offsets: &OffsetsBuffer<i32>) -> Self
fn from(offsets: &OffsetsBuffer<i32>) -> Self
Converts to this type from the input type.
source§impl<O: PartialEq + Offset> PartialEq for OffsetsBuffer<O>
impl<O: PartialEq + Offset> PartialEq for OffsetsBuffer<O>
source§fn eq(&self, other: &OffsetsBuffer<O>) -> bool
fn eq(&self, other: &OffsetsBuffer<O>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl TryFrom<&OffsetsBuffer<i64>> for OffsetsBuffer<i32>
impl TryFrom<&OffsetsBuffer<i64>> for OffsetsBuffer<i32>
impl<O: Offset> StructuralPartialEq for OffsetsBuffer<O>
Auto Trait Implementations§
impl<O> Freeze for OffsetsBuffer<O>
impl<O> RefUnwindSafe for OffsetsBuffer<O>where
O: RefUnwindSafe,
impl<O> Send for OffsetsBuffer<O>
impl<O> Sync for OffsetsBuffer<O>
impl<O> Unpin for OffsetsBuffer<O>
impl<O> UnwindSafe for OffsetsBuffer<O>where
O: RefUnwindSafe,
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