pub enum DataArrayValues {
F64(Vec<f64>),
I8(Vec<i8>),
I16(Vec<i16>),
I32(Vec<i32>),
I64(Vec<i64>),
U8(Vec<u8>),
U16(Vec<u16>),
U32(Vec<u32>),
U64(Vec<u64>),
}Expand description
The persisted backing values of a data-array payload.
JSON arrays written before integer storage was introduced are decoded as
F64; new writes use the tagged representation below so every integer
class can round-trip without passing through a floating point value.
Variants§
F64(Vec<f64>)
I8(Vec<i8>)
I16(Vec<i16>)
I32(Vec<i32>)
I64(Vec<i64>)
U8(Vec<u8>)
U16(Vec<u16>)
U32(Vec<u32>)
U64(Vec<u64>)
Implementations§
Source§impl DataArrayValues
impl DataArrayValues
pub fn zeros(dtype: &str, len: usize) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn into_tensor(self, shape: Vec<usize>) -> Result<Tensor, String>
pub fn to_f64_vec(&self) -> Vec<f64>
Sourcepub fn preview_f64(&self, limit: usize) -> Vec<f64>
pub fn preview_f64(&self, limit: usize) -> Vec<f64>
Returns at most limit values converted to the numeric preview format.
Data-file previews cross the WASM boundary as JavaScript numbers. Keep that established representation while only converting the requested prefix: a fallback full-payload read may contain substantially more values than the preview is allowed to return.
pub fn get(&self, index: usize) -> BuiltinResult<DataScalar>
pub fn push(&mut self, value: DataScalar) -> BuiltinResult<()>
pub fn set(&mut self, index: usize, value: DataScalar) -> BuiltinResult<()>
Trait Implementations§
Source§impl Clone for DataArrayValues
impl Clone for DataArrayValues
Source§fn clone(&self) -> DataArrayValues
fn clone(&self) -> DataArrayValues
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 DataArrayValues
impl Debug for DataArrayValues
Source§impl<'de> Deserialize<'de> for DataArrayValues
impl<'de> Deserialize<'de> for DataArrayValues
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for DataArrayValues
impl PartialEq for DataArrayValues
Source§impl Serialize for DataArrayValues
impl Serialize for DataArrayValues
impl StructuralPartialEq for DataArrayValues
Auto Trait Implementations§
impl Freeze for DataArrayValues
impl RefUnwindSafe for DataArrayValues
impl Send for DataArrayValues
impl Sync for DataArrayValues
impl Unpin for DataArrayValues
impl UnsafeUnpin for DataArrayValues
impl UnwindSafe for DataArrayValues
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
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.