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 position i-1.

Implementations§

source§

impl<O: Offset> OffsetsBuffer<O>

source

pub unsafe fn new_unchecked(offsets: Buffer<O>) -> Self

§Safety

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

source

pub fn new() -> Self

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

source

pub fn get_mut(&mut self) -> Option<Offsets<O>>

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

source

pub fn buffer(&self) -> &Buffer<O>

Returns a reference to its internal Buffer.

source

pub fn len(&self) -> usize

Returns the length of this container

source

pub fn as_slice(&self) -> &[O]

Returns the byte slice stored in this buffer

source

pub fn last(&self) -> &O

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

source

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()

source

pub unsafe fn start_end_unchecked(&self, index: usize) -> (usize, usize)

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

§Safety

index must be < self.len()

source

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()

source

pub fn lengths(&self) -> impl Iterator<Item = usize> + '_

Returns an iterator with the lengths of the offsets

source

pub fn into_inner(self) -> Buffer<O>

Returns the inner Buffer.

Trait Implementations§

source§

impl<O: Clone + Offset> Clone for OffsetsBuffer<O>

source§

fn clone(&self) -> OffsetsBuffer<O>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<O: Debug + Offset> Debug for OffsetsBuffer<O>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<O: Offset> Default for OffsetsBuffer<O>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl From<&OffsetsBuffer<i32>> for OffsetsBuffer<i64>

source§

fn from(offsets: &OffsetsBuffer<i32>) -> Self

Converts to this type from the input type.
source§

impl<O: Offset> From<Offsets<O>> for OffsetsBuffer<O>

source§

fn from(offsets: Offsets<O>) -> Self

Converts to this type from the input type.
source§

impl<O: PartialEq + Offset> PartialEq for OffsetsBuffer<O>

source§

fn eq(&self, other: &OffsetsBuffer<O>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<&OffsetsBuffer<i64>> for OffsetsBuffer<i32>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(offsets: &OffsetsBuffer<i64>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<O: Offset> TryFrom<Buffer<O>> for OffsetsBuffer<O>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(offsets: Buffer<O>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<O: Offset> TryFrom<Vec<O>> for OffsetsBuffer<O>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(offsets: Vec<O>) -> Result<Self, Self::Error>

Performs the conversion.
source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.