CharsTape

Struct CharsTape 

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

Source

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

Creates a new, empty CharsTape with the global allocator.

Source

pub fn new_in(allocator: A) -> Self

Creates a new, empty CharsTape with a custom allocator.

Source

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.

Source

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.

Source

pub fn push(&mut self, s: &str) -> Result<(), StringTapeError>

Adds a string to the end of the CharsTape.

Source

pub fn get(&self, index: usize) -> Option<&str>

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

Source

pub fn len(&self) -> usize

Returns the number of strings in the CharsTape.

Source

pub fn is_empty(&self) -> bool

Returns true if the CharsTape contains no strings.

Source

pub fn data_len(&self) -> usize

Returns the total number of bytes used by string data.

Source

pub fn capacity(&self) -> usize

Returns the number of strings currently stored (same as len()).

Source

pub fn data_capacity(&self) -> usize

Returns the number of bytes allocated for string data.

Source

pub fn offsets_capacity(&self) -> usize

Returns the number of offset slots allocated.

Source

pub fn clear(&mut self)

Removes all strings from the CharsTape, keeping allocated capacity.

Source

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

Shortens the CharsTape, keeping the first len strings and dropping the rest.

Source

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

Extends the CharsTape with the contents of an iterator.

Source

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

Returns the raw parts of the CharsTape 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 iter(&self) -> CharsTapeIter<'_, Offset, A>

Source

pub fn allocator(&self) -> &A

Returns a reference to the allocator used by this CharsTape.

Source

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

Creates a view of the entire CharsTape.

Source

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

Creates a subview of a continuous slice of this CharsTape.

Source

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

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

Source§

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

Source

pub fn into_bytes_tape(self) -> BytesTape<Offset, A>

Trait Implementations§

Source§

impl<Offset: OffsetType> Default for CharsTape<Offset, Global>

Source§

fn default() -> Self

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

impl<Offset: OffsetType, A: Allocator> Drop for CharsTape<Offset, A>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<Offset: OffsetType, A: Allocator> From<CharsTape<Offset, A>> for BytesTape<Offset, A>

Source§

fn from(chars_tape: CharsTape<Offset, A>) -> Self

Converts to this type from the input type.
Source§

impl<'a, Offset: OffsetType> FromIterator<&'a str> for CharsTape<Offset, Global>

Source§

fn from_iter<I: IntoIterator<Item = &'a str>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<Offset: OffsetType> FromIterator<String> for CharsTape<Offset, Global>

Source§

fn from_iter<I: IntoIterator<Item = String>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

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

Source§

type Output = str

The returned type after indexing.
Source§

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

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

impl<'a, Offset: OffsetType, A: Allocator> IntoIterator for &'a CharsTape<Offset, A>

Source§

type Item = &'a str

The type of the elements being iterated over.
Source§

type IntoIter = CharsTapeIter<'a, Offset, A>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<Offset: OffsetType, A: Allocator> TryFrom<BytesTape<Offset, A>> for CharsTape<Offset, A>

Source§

type Error = StringTapeError

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

fn try_from(bytes_tape: BytesTape<Offset, A>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<Offset: OffsetType + Send, A: Allocator + Send> Send for CharsTape<Offset, A>

Source§

impl<Offset: OffsetType + Sync, A: Allocator + Sync> Sync for CharsTape<Offset, A>

Auto Trait Implementations§

§

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

§

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

§

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

§

impl<Offset, A> UnwindSafe for CharsTape<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.