pub struct StringArray<D: Dimension> { /* private fields */ }Expand description
A specialized N-dimensional array of strings.
Unlike ferray_core::Array, this type does not require Element —
it stores Vec<String> directly with shape metadata for indexing.
The data is stored in row-major (C) order.
Implementations§
Source§impl<D: Dimension> StringArray<D>
impl<D: Dimension> StringArray<D>
Sourcepub fn from_vec(dim: D, data: Vec<String>) -> FerrayResult<Self>
pub fn from_vec(dim: D, data: Vec<String>) -> FerrayResult<Self>
Create a new StringArray from a flat vector of strings and a shape.
§Errors
Returns FerrayError::ShapeMismatch if data.len() does not equal
the product of the shape dimensions.
Sourcepub fn empty(dim: D) -> FerrayResult<Self>
pub fn empty(dim: D) -> FerrayResult<Self>
Create a StringArray filled with empty strings.
§Errors
This function is infallible for valid shapes but returns Result
for API consistency.
Sourcepub fn as_slice_mut(&mut self) -> &mut [String]
pub fn as_slice_mut(&mut self) -> &mut [String]
Return a mutable reference to the flat data.
Sourcepub fn map<F>(&self, f: F) -> FerrayResult<StringArray<D>>
pub fn map<F>(&self, f: F) -> FerrayResult<StringArray<D>>
Apply a function to each element, producing a new StringArray.
Sourcepub fn map_to_vec<T, F>(&self, f: F) -> Vec<T>
pub fn map_to_vec<T, F>(&self, f: F) -> Vec<T>
Apply a function to each element, producing a Vec<T>.
This is a lower-level helper used by search and boolean operations
that need to produce typed arrays (e.g., Array<bool, D>).
Source§impl StringArray<Ix1>
impl StringArray<Ix1>
Sourcepub fn from_slice(items: &[&str]) -> FerrayResult<Self>
pub fn from_slice(items: &[&str]) -> FerrayResult<Self>
Source§impl StringArray<Ix2>
impl StringArray<Ix2>
Sourcepub fn from_rows(rows: &[&[&str]]) -> FerrayResult<Self>
pub fn from_rows(rows: &[&[&str]]) -> FerrayResult<Self>
Create a 2-D StringArray from nested slices.
§Errors
Returns FerrayError::ShapeMismatch if inner slices have different lengths.
Source§impl StringArray<IxDyn>
impl StringArray<IxDyn>
Sourcepub fn from_vec_dyn(shape: &[usize], data: Vec<String>) -> FerrayResult<Self>
pub fn from_vec_dyn(shape: &[usize], data: Vec<String>) -> FerrayResult<Self>
Create a dynamic-rank StringArray from a flat vec and a dynamic shape.
Trait Implementations§
Source§impl<D: Clone + Dimension> Clone for StringArray<D>
impl<D: Clone + Dimension> Clone for StringArray<D>
Source§fn clone(&self) -> StringArray<D>
fn clone(&self) -> StringArray<D>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more