BytesTape

Struct BytesTape 

Source
pub struct BytesTape<Offset: OffsetType = i32, A: Allocator = Global> { /* private fields */ }
Expand description

Binary bytes view over RawTape.

Implementations§

Source§

impl<Offset: OffsetType, A: Allocator> BytesTape<Offset, A>

Source

pub fn new() -> BytesTape<Offset, Global>

Creates a new, empty BytesTape with the global allocator.

Source

pub fn new_in(allocator: A) -> Self

Creates a new, empty BytesTape with a custom allocator.

Source

pub fn with_capacity( data_capacity: usize, items_capacity: usize, ) -> Result<BytesTape<Offset, Global>, StringTapeError>

Creates a new BytesTape with pre-allocated capacity using the global allocator.

Source

pub fn with_capacity_in( data_capacity: usize, items_capacity: usize, allocator: A, ) -> Result<Self, StringTapeError>

Creates a new BytesTape with pre-allocated capacity and a custom allocator.

Source

pub fn push(&mut self, bytes: &[u8]) -> Result<(), StringTapeError>

Adds bytes to the end of the tape.

Source

pub fn get(&self, index: usize) -> Option<&[u8]>

Returns a reference to the bytes at the given index, or None if out of bounds.

Source

pub fn len(&self) -> usize

Returns the number of items in the tape.

Source

pub fn is_empty(&self) -> bool

Returns true if the tape contains no items.

Source

pub fn data_len(&self) -> usize

Returns the total number of bytes used by data.

Source

pub fn data_capacity(&self) -> usize

Returns the number of bytes allocated for data.

Source

pub fn offsets_capacity(&self) -> usize

Returns the number of offset slots allocated.

Source

pub fn clear(&mut self)

Removes all items from the tape, keeping allocated capacity.

Source

pub fn truncate(&mut self, len: usize)

Shortens the tape, keeping the first len items and dropping the rest.

Source

pub fn extend<I>(&mut self, iter: I) -> Result<(), StringTapeError>
where I: IntoIterator, I::Item: AsRef<[u8]>,

Extends the tape with the contents of an iterator of bytes.

Source

pub fn as_raw_parts(&self) -> RawParts<Offset>

Returns the raw parts of the tape for Apache Arrow compatibility.

Source

pub fn data_slice(&self) -> &[u8]

Returns a slice view of the data buffer.

Source

pub fn offsets_slice(&self) -> &[Offset]

Returns a slice view of the offsets buffer.

Source

pub fn allocator(&self) -> &A

Returns a reference to the allocator used by this BytesTape.

Source

pub fn view(&self) -> BytesTapeView<'_, Offset>

Creates a view of the entire BytesTape.

Source

pub fn subview( &self, start: usize, end: usize, ) -> Result<BytesTapeView<'_, Offset>, StringTapeError>

Creates a subview of a continuous slice of this BytesTape.

Source

pub fn arrow_slices(&self) -> (&[u8], &[Offset])

Returns data and offsets slices for zero-copy Arrow conversion.

Trait Implementations§

Source§

impl<Offset: OffsetType, A: Allocator> Index<usize> for BytesTape<Offset, A>

Source§

type Output = [u8]

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<Offset, A> Freeze for BytesTape<Offset, A>
where A: Freeze,

§

impl<Offset, A> RefUnwindSafe for BytesTape<Offset, A>
where A: RefUnwindSafe, Offset: RefUnwindSafe,

§

impl<Offset, A> Send for BytesTape<Offset, A>
where Offset: Send, A: Send,

§

impl<Offset, A> Sync for BytesTape<Offset, A>
where Offset: Sync, A: Sync,

§

impl<Offset, A> Unpin for BytesTape<Offset, A>
where A: Unpin, Offset: Unpin,

§

impl<Offset, A> UnwindSafe for BytesTape<Offset, A>
where A: UnwindSafe, Offset: UnwindSafe + 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.