pub enum Value {
}Expand description
Variants§
None
Python None.
Bool(bool)
Booleans, one byte each, as in numpy bool_.
Int(i64)
Python int that fits in 64 bits.
BigInt(Vec<u8>)
Arbitrary precision int, little-endian two’s complement.
Float(f64)
A Python float.
Complex(Complex64)
A Python complex.
Str(String)
Fixed-width UTF-32 text, the inner value being the character count.
Bytes(Vec<u8>)
Fixed-width byte string, the inner value being the length.
List(Vec<Value>)
A Python list.
Tuple(Vec<Value>)
A Python tuple.
Set(Vec<Value>)
A Python set or frozenset.
Dict(Dict)
A Python dict, insertion order preserved.
Array(Array)
np.ndarray, torch.Tensor, HDF5 dataset, npy payload.
Frame(Frame)
pandas.DataFrame, polars.DataFrame, numpy record array.
Object(PyObject)
Anything else, captured structurally without executing Python.
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_array_mut(&mut self) -> Option<&mut Array>
pub fn as_array_mut(&mut self) -> Option<&mut Array>
Mutable array view — scale or normalise weights before loading them.
Sourcepub fn as_dict_mut(&mut self) -> Option<&mut Dict>
pub fn as_dict_mut(&mut self) -> Option<&mut Dict>
Borrow the contents as dict mut, when the type matches.
Sourcepub fn as_frame_mut(&mut self) -> Option<&mut Frame>
pub fn as_frame_mut(&mut self) -> Option<&mut Frame>
Borrow the contents as frame mut, when the type matches.
Sourcepub fn as_object(&self) -> Option<&PyObject>
pub fn as_object(&self) -> Option<&PyObject>
Borrow the contents as object, when the type matches.
Sourcepub fn type_name(&self) -> &'static str
pub fn type_name(&self) -> &'static str
Short human-readable type name, handy in error messages.
Sourcepub fn arrays_mut(&mut self) -> Vec<&mut Array>
pub fn arrays_mut(&mut self) -> Vec<&mut Array>
Depth-first walk over every Array contained anywhere in the value.
Trait Implementations§
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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
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,
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> ⓘ
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> ⓘ
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