#[non_exhaustive]#[repr(C)]pub enum Def {
Undefined,
Scalar,
Map(MapDef),
Set(SetDef),
List(ListDef),
Array(ArrayDef),
NdArray(NdArrayDef),
Slice(SliceDef),
Option(OptionDef),
Pointer(PointerDef),
}Expand description
The semantic definition of a shape: is it more like a scalar, a map, a list?
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Undefined
Undefined - you can interact with the type through Type and ValueVTable.
Scalar
Scalar — those don’t have a def, they’re not composed of other things.
You can interact with them through ValueVTable.
e.g. u32, String, bool, SocketAddr, etc.
Map(MapDef)
Map — keys are dynamic (and strings, sorry), values are homogeneous
e.g. HashMap<String, T>
Set(SetDef)
Unique set of homogenous values
e.g. HashSet<T>
List(ListDef)
Ordered list of homogenous values, variable size
e.g. Vec<T>
Array(ArrayDef)
Fixed-size array of homogeneous values, fixed size
e.g. [T; 3]
NdArray(NdArrayDef)
n-dimensional array of homogeneous values, fixed size
e.g. Vector<T>, Matrix<T>, Tensor<T>
Slice(SliceDef)
Slice - a reference to a contiguous sequence of elements
e.g. [T]
Option(OptionDef)
Option
e.g. Option<T>
Pointer(PointerDef)
Pointer types like Arc<T>, Rc<T>, etc.
Implementations§
Source§impl Def
impl Def
Sourcepub fn into_scalar(self) -> Result<(), Self>
pub fn into_scalar(self) -> Result<(), Self>
Returns the ScalarDef wrapped in an Ok if this is a Def::Scalar.
Sourcepub fn into_map(self) -> Result<MapDef, Self>
pub fn into_map(self) -> Result<MapDef, Self>
Returns the MapDef wrapped in an Ok if this is a Def::Map.
Sourcepub fn into_set(self) -> Result<SetDef, Self>
pub fn into_set(self) -> Result<SetDef, Self>
Returns the SetDef wrapped in an Ok if this is a Def::Set.
Sourcepub fn into_list(self) -> Result<ListDef, Self>
pub fn into_list(self) -> Result<ListDef, Self>
Returns the ListDef wrapped in an Ok if this is a Def::List.
Sourcepub fn into_array(self) -> Result<ArrayDef, Self>
pub fn into_array(self) -> Result<ArrayDef, Self>
Returns the ArrayDef wrapped in an Ok if this is a Def::Array.
Sourcepub fn into_ndarray(self) -> Result<NdArrayDef, Self>
pub fn into_ndarray(self) -> Result<NdArrayDef, Self>
Returns the NdArrayDef wrapped in an Ok if this is a Def::NdArray.
Sourcepub fn into_slice(self) -> Result<SliceDef, Self>
pub fn into_slice(self) -> Result<SliceDef, Self>
Returns the SliceDef wrapped in an Ok if this is a Def::Slice.
Sourcepub fn into_option(self) -> Result<OptionDef, Self>
pub fn into_option(self) -> Result<OptionDef, Self>
Returns the OptionDef wrapped in an Ok if this is a Def::Option.
Sourcepub fn into_pointer(self) -> Result<PointerDef, Self>
pub fn into_pointer(self) -> Result<PointerDef, Self>
Returns the PointerDef wrapped in an Ok if this is a Def::Pointer.