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 offsets_capacity(&self) -> usize
pub fn offsets_capacity(&self) -> usize
Returns the number of offset slots allocated.
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) -> RawParts<Offset>
pub fn as_raw_parts(&self) -> RawParts<Offset>
Returns the raw parts of the tape for Apache Arrow compatibility.
Sourcepub fn data_slice(&self) -> &[u8] ⓘ
pub fn data_slice(&self) -> &[u8] ⓘ
Returns a slice view of the data buffer.
Sourcepub fn offsets_slice(&self) -> &[Offset]
pub fn offsets_slice(&self) -> &[Offset]
Returns a slice view of the offsets buffer.
Sourcepub fn view(&self) -> BytesTapeView<'_, Offset>
pub fn view(&self) -> BytesTapeView<'_, Offset>
Creates a view of the entire BytesTape.
Sourcepub fn subview(
&self,
start: usize,
end: usize,
) -> Result<BytesTapeView<'_, Offset>, StringTapeError>
pub fn subview( &self, start: usize, end: usize, ) -> Result<BytesTapeView<'_, Offset>, StringTapeError>
Creates a subview of a continuous slice of this BytesTape.
Sourcepub fn arrow_slices(&self) -> (&[u8], &[Offset])
pub fn arrow_slices(&self) -> (&[u8], &[Offset])
Returns data and offsets slices for zero-copy Arrow conversion.