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>
impl<Offset: OffsetType, A: Allocator> BytesTape<Offset, A>
Sourcepub fn new() -> BytesTape<Offset, Global>
pub fn new() -> BytesTape<Offset, Global>
Creates a new, empty BytesTape with the global allocator.
Sourcepub fn with_capacity(
data_capacity: usize,
items_capacity: usize,
) -> Result<BytesTape<Offset, Global>, StringTapeError>
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.
Sourcepub fn with_capacity_in(
data_capacity: usize,
items_capacity: usize,
allocator: A,
) -> Result<Self, StringTapeError>
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.
Sourcepub fn push(&mut self, bytes: &[u8]) -> Result<(), StringTapeError>
pub fn push(&mut self, bytes: &[u8]) -> Result<(), StringTapeError>
Adds bytes to the end of the tape.
Sourcepub fn get(&self, index: usize) -> Option<&[u8]>
pub fn get(&self, index: usize) -> Option<&[u8]>
Returns a reference to the bytes at the given index, or None if out of bounds.
Sourcepub fn data_capacity(&self) -> usize
pub fn data_capacity(&self) -> usize
Returns the number of bytes allocated for data.
Sourcepub fn truncate(&mut self, len: usize)
pub fn truncate(&mut self, len: usize)
Shortens the tape, keeping the first len items and dropping the rest.
Sourcepub fn extend<I>(&mut self, iter: I) -> Result<(), StringTapeError>
pub fn extend<I>(&mut self, iter: I) -> Result<(), StringTapeError>
Extends the tape with the contents of an iterator of bytes.
Sourcepub fn as_raw_parts(&self) -> (*const u8, *const Offset, usize, usize)
pub fn as_raw_parts(&self) -> (*const u8, *const Offset, usize, usize)
Returns the raw parts of the tape for Apache Arrow compatibility.
Trait Implementations§
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>
impl<Offset, A> Sync for BytesTape<Offset, A>
impl<Offset, A> Unpin for BytesTape<Offset, A>
impl<Offset, A> UnwindSafe for BytesTape<Offset, A>
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