#[non_exhaustive]pub enum Def {
Scalar(ScalarDef),
Struct(StructDef),
Map(MapDef),
List(ListDef),
Enum(EnumDef),
}Expand description
The definition of a shape: is it more like a struct, a map, a list?
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Scalar(ScalarDef)
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.
Struct(StructDef)
Various kinds of structs, see StructKind
e.g. struct Struct { field: u32 }, struct TupleStruct(u32, u32);, (u32, u32)
Map(MapDef)
Map — keys are dynamic (and strings, sorry), values are homogeneous
e.g. Map<String, T>
List(ListDef)
Ordered list of heterogenous values, variable size
e.g. Vec<T>
Enum(EnumDef)
Enum with variants
e.g. enum Enum { Variant1, Variant2 }
Trait Implementations§
impl Copy for Def
impl Eq for Def
impl StructuralPartialEq for Def
Auto Trait Implementations§
impl Freeze for Def
impl RefUnwindSafe for Def
impl Send for Def
impl Sync for Def
impl Unpin for Def
impl UnwindSafe for Def
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