pub struct Dataset {
pub name: String,
pub dtype: DataType,
pub shape: DatasetShape,
pub data: Vec<u8>,
pub attributes: Vec<Attribute>,
}Expand description
A named, typed, shaped array of raw bytes with optional attributes.
Fields§
§name: String§dtype: DataType§shape: DatasetShape§data: Vec<u8>Raw little-endian bytes of the dataset contents.
attributes: Vec<Attribute>Implementations§
Source§impl Dataset
impl Dataset
Sourcepub fn from_f64_slice(name: &str, data: &[f64], shape: DatasetShape) -> Self
pub fn from_f64_slice(name: &str, data: &[f64], shape: DatasetShape) -> Self
Constructs a dataset from a slice of f64 values.
Sourcepub fn from_f32_slice(name: &str, data: &[f32], shape: DatasetShape) -> Self
pub fn from_f32_slice(name: &str, data: &[f32], shape: DatasetShape) -> Self
Constructs a dataset from a slice of f32 values.
Sourcepub fn from_i32_slice(name: &str, data: &[i32], shape: DatasetShape) -> Self
pub fn from_i32_slice(name: &str, data: &[i32], shape: DatasetShape) -> Self
Constructs a dataset from a slice of i32 values.
Sourcepub fn to_f64_vec(&self) -> Result<Vec<f64>, String>
pub fn to_f64_vec(&self) -> Result<Vec<f64>, String>
Decodes the raw bytes back into a Vecf64`.
Sourcepub fn to_f32_vec(&self) -> Result<Vec<f32>, String>
pub fn to_f32_vec(&self) -> Result<Vec<f32>, String>
Decodes the raw bytes back into a Vecf32`.
Sourcepub fn to_i32_vec(&self) -> Result<Vec<i32>, String>
pub fn to_i32_vec(&self) -> Result<Vec<i32>, String>
Decodes the raw bytes back into a Veci32`.
Sourcepub fn add_attribute(&mut self, attr: Attribute)
pub fn add_attribute(&mut self, attr: Attribute)
Appends an attribute to this dataset.
Sourcepub fn get_attribute(&self, name: &str) -> Option<&Attribute>
pub fn get_attribute(&self, name: &str) -> Option<&Attribute>
Looks up an attribute by name.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dataset
impl RefUnwindSafe for Dataset
impl Send for Dataset
impl Sync for Dataset
impl Unpin for Dataset
impl UnsafeUnpin for Dataset
impl UnwindSafe for Dataset
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.