pub struct ShdfFile {
pub datasets: Vec<Dataset>,
pub global_attributes: Vec<(String, String)>,
}Expand description
An in-memory .shdf file.
Fields§
§datasets: Vec<Dataset>Ordered list of datasets.
global_attributes: Vec<(String, String)>File-level key/value string attributes.
Implementations§
Source§impl ShdfFile
impl ShdfFile
Sourcepub fn add_dataset_f64(&mut self, name: &str, shape: Vec<usize>, data: Vec<f64>)
pub fn add_dataset_f64(&mut self, name: &str, shape: Vec<usize>, data: Vec<f64>)
Append a Float64 dataset.
Sourcepub fn add_dataset_i32(&mut self, name: &str, shape: Vec<usize>, data: Vec<i32>)
pub fn add_dataset_i32(&mut self, name: &str, shape: Vec<usize>, data: Vec<i32>)
Append an Int32 dataset.
Sourcepub fn add_global_attr(&mut self, key: &str, value: &str)
pub fn add_global_attr(&mut self, key: &str, value: &str)
Add a global (file-level) key/value attribute.
Sourcepub fn get_f64(&self, name: &str) -> Option<&[f64]>
pub fn get_f64(&self, name: &str) -> Option<&[f64]>
Look up a Float64 dataset by name and return its data slice.
Sourcepub fn get_i32(&self, name: &str) -> Option<&[i32]>
pub fn get_i32(&self, name: &str) -> Option<&[i32]>
Look up an Int32 dataset by name and return its data slice.
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, String>
pub fn from_bytes(data: &[u8]) -> Result<Self, String>
Deserialize a binary blob written by ShdfFile::to_bytes.
Returns Err(String) on any format violation.
Sourcepub fn write_to_text(&self) -> String
pub fn write_to_text(&self) -> String
Return a human-readable summary of the file contents.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ShdfFile
impl RefUnwindSafe for ShdfFile
impl Send for ShdfFile
impl Sync for ShdfFile
impl Unpin for ShdfFile
impl UnsafeUnpin for ShdfFile
impl UnwindSafe for ShdfFile
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.