pub struct CharsTape<Offset: OffsetType = i32, A: Allocator = Global> { /* private fields */ }Expand description
UTF-8 string view over RawTape.
Implementations§
Source§impl<Offset: OffsetType, A: Allocator> CharsTape<Offset, A>
impl<Offset: OffsetType, A: Allocator> CharsTape<Offset, A>
Sourcepub fn new() -> CharsTape<Offset, Global>
pub fn new() -> CharsTape<Offset, Global>
Creates a new, empty CharsTape with the global allocator.
Sourcepub fn with_capacity(
data_capacity: usize,
strings_capacity: usize,
) -> Result<CharsTape<Offset, Global>, StringTapeError>
pub fn with_capacity( data_capacity: usize, strings_capacity: usize, ) -> Result<CharsTape<Offset, Global>, StringTapeError>
Creates a new CharsTape with pre-allocated capacity using the global allocator.
Sourcepub fn with_capacity_in(
data_capacity: usize,
strings_capacity: usize,
allocator: A,
) -> Result<Self, StringTapeError>
pub fn with_capacity_in( data_capacity: usize, strings_capacity: usize, allocator: A, ) -> Result<Self, StringTapeError>
Creates a new CharsTape with pre-allocated capacity and a custom allocator.
Sourcepub fn push(&mut self, s: &str) -> Result<(), StringTapeError>
pub fn push(&mut self, s: &str) -> Result<(), StringTapeError>
Adds a string to the end of the CharsTape.
Sourcepub fn get(&self, index: usize) -> Option<&str>
pub fn get(&self, index: usize) -> Option<&str>
Returns a reference to the string at the given index, or None if out of bounds.
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of strings currently stored (same as len()).
Sourcepub fn data_capacity(&self) -> usize
pub fn data_capacity(&self) -> usize
Returns the number of bytes allocated for string 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 CharsTape, keeping the first len strings 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 CharsTape with the contents of an iterator.
Sourcepub fn as_raw_parts(&self) -> RawParts<Offset>
pub fn as_raw_parts(&self) -> RawParts<Offset>
Returns the raw parts of the CharsTape 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.
pub fn iter(&self) -> CharsTapeIter<'_, Offset, A> ⓘ
Sourcepub fn view(&self) -> CharsTapeView<'_, Offset>
pub fn view(&self) -> CharsTapeView<'_, Offset>
Creates a view of the entire CharsTape.
Sourcepub fn subview(
&self,
start: usize,
end: usize,
) -> Result<CharsTapeView<'_, Offset>, StringTapeError>
pub fn subview( &self, start: usize, end: usize, ) -> Result<CharsTapeView<'_, Offset>, StringTapeError>
Creates a subview of a continuous slice of this CharsTape.
Sourcepub fn arrow_slices(&self) -> (&[u8], &[Offset])
pub fn arrow_slices(&self) -> (&[u8], &[Offset])
Returns data and offsets slices for zero-copy Arrow conversion.