#[repr(C)]pub enum Def<'shape> {
Undefined,
Scalar,
Map(MapDef<'shape>),
Set(SetDef<'shape>),
List(ListDef<'shape>),
Array(ArrayDef<'shape>),
Slice(SliceDef<'shape>),
Option(OptionDef<'shape>),
Pointer(PointerDef<'shape>),
}Expand description
The semantic definition of a shape: is it more like a scalar, a map, a list?
Variants§
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<'shape>)
Map — keys are dynamic (and strings, sorry), values are homogeneous
e.g. HashMap<String, T>
Set(SetDef<'shape>)
Unique set of homogenous values
e.g. HashSet<T>
List(ListDef<'shape>)
Ordered list of heterogenous values, variable size
e.g. Vec<T>
Array(ArrayDef<'shape>)
Fixed-size array of heterogeneous values, fixed size
e.g. [T; 3]
Slice(SliceDef<'shape>)
Slice - a reference to a contiguous sequence of elements
e.g. [T]
Option(OptionDef<'shape>)
Option
e.g. Option<T>
Pointer(PointerDef<'shape>)
Smart pointers, like Arc<T>, Rc<T>, etc.
Implementations§
Source§impl<'shape> Def<'shape>
impl<'shape> Def<'shape>
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<'shape>, Self>
pub fn into_map(self) -> Result<MapDef<'shape>, Self>
Returns the MapDef wrapped in an Ok if this is a Def::Map.
Sourcepub fn into_set(self) -> Result<SetDef<'shape>, Self>
pub fn into_set(self) -> Result<SetDef<'shape>, Self>
Returns the SetDef wrapped in an Ok if this is a Def::Set.
Sourcepub fn into_list(self) -> Result<ListDef<'shape>, Self>
pub fn into_list(self) -> Result<ListDef<'shape>, Self>
Returns the ListDef wrapped in an Ok if this is a Def::List.
Sourcepub fn into_array(self) -> Result<ArrayDef<'shape>, Self>
pub fn into_array(self) -> Result<ArrayDef<'shape>, Self>
Returns the ArrayDef wrapped in an Ok if this is a Def::Array.
Sourcepub fn into_slice(self) -> Result<SliceDef<'shape>, Self>
pub fn into_slice(self) -> Result<SliceDef<'shape>, Self>
Returns the SliceDef wrapped in an Ok if this is a Def::Slice.
Sourcepub fn into_option(self) -> Result<OptionDef<'shape>, Self>
pub fn into_option(self) -> Result<OptionDef<'shape>, Self>
Returns the OptionDef wrapped in an Ok if this is a Def::Option.
Sourcepub fn into_pointer(self) -> Result<PointerDef<'shape>, Self>
pub fn into_pointer(self) -> Result<PointerDef<'shape>, Self>
Returns the PointerDef wrapped in an Ok if this is a Def::Pointer.