pub struct StructuredArray { /* private fields */ }Expand description
A structured array that can hold records with multiple named fields of different types
Implementations§
Source§impl StructuredArray
impl StructuredArray
Sourcepub fn new(fields: Vec<FieldDescriptor>, len: usize) -> Self
pub fn new(fields: Vec<FieldDescriptor>, len: usize) -> Self
Create a new structured array with the given fields and capacity
Sourcepub fn with_shape(fields: Vec<FieldDescriptor>, shape: &[usize]) -> Self
pub fn with_shape(fields: Vec<FieldDescriptor>, shape: &[usize]) -> Self
Create a new multi-dimensional structured array
Sourcepub fn fields(&self) -> &[FieldDescriptor]
pub fn fields(&self) -> &[FieldDescriptor]
Get the field descriptors
Sourcepub fn field(&self, name: &str) -> Option<&FieldDescriptor>
pub fn field(&self, name: &str) -> Option<&FieldDescriptor>
Get a field descriptor by name
Sourcepub fn field_names(&self) -> Vec<&str>
pub fn field_names(&self) -> Vec<&str>
Get field names
Sourcepub fn set_field_value(
&mut self,
record_idx: usize,
field_name: &str,
value: FieldValue,
) -> Result<()>
pub fn set_field_value( &mut self, record_idx: usize, field_name: &str, value: FieldValue, ) -> Result<()>
Set a field value for a specific record
Sourcepub fn get_field_value(
&self,
record_idx: usize,
field_name: &str,
) -> Result<FieldValue>
pub fn get_field_value( &self, record_idx: usize, field_name: &str, ) -> Result<FieldValue>
Get a field value for a specific record
Sourcepub fn get_record(
&self,
record_idx: usize,
) -> Result<HashMap<String, FieldValue>>
pub fn get_record( &self, record_idx: usize, ) -> Result<HashMap<String, FieldValue>>
Get all field values for a specific record as a map
Sourcepub fn set_record(
&mut self,
record_idx: usize,
values: HashMap<String, FieldValue>,
) -> Result<()>
pub fn set_record( &mut self, record_idx: usize, values: HashMap<String, FieldValue>, ) -> Result<()>
Set all field values for a specific record
Sourcepub fn get_column(&self, field_name: &str) -> Result<Vec<FieldValue>>
pub fn get_column(&self, field_name: &str) -> Result<Vec<FieldValue>>
Extract a column (field) as a vector of values
Sourcepub fn slice(&self, start: usize, end: usize) -> Result<StructuredArray>
pub fn slice(&self, start: usize, end: usize) -> Result<StructuredArray>
Get a slice of records
Sourcepub fn from_bytes(
fields: Vec<FieldDescriptor>,
data: Vec<u8>,
len: usize,
) -> Result<Self>
pub fn from_bytes( fields: Vec<FieldDescriptor>, data: Vec<u8>, len: usize, ) -> Result<Self>
Create from raw bytes (unsafe - no validation)
Trait Implementations§
Source§impl Clone for StructuredArray
impl Clone for StructuredArray
Source§fn clone(&self) -> StructuredArray
fn clone(&self) -> StructuredArray
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StructuredArray
impl Debug for StructuredArray
Auto Trait Implementations§
impl Freeze for StructuredArray
impl RefUnwindSafe for StructuredArray
impl Send for StructuredArray
impl Sync for StructuredArray
impl Unpin for StructuredArray
impl UnsafeUnpin for StructuredArray
impl UnwindSafe for StructuredArray
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more