pub unsafe trait Facet<'facet>: 'facet {
const SHAPE: &'static Shape;
}Expand description
Allows querying the Shape of a type, which in turn lets us inspect any fields, build a value of
this type progressively, etc.
The 'facet lifetime allows Facet to be derived for types that borrow from something else.
§Safety
If you implement this wrong, all the safe abstractions in facet-reflect,
all the serializers, deserializers, the entire ecosystem is unsafe.
You’re responsible for describing the type layout properly, and annotating all the invariants.
Required Associated Constants§
Sourceconst SHAPE: &'static Shape
const SHAPE: &'static Shape
The shape of this type, including: whether it’s a Struct, an Enum, something else?
All its fields, with their names, types, attributes, doc comments, etc. VTables for list operations, set operations, map operations, option operations, and implementations for Display, Debug, etc.—marker traits like Send, Sync, Copy, Eq, and probably other things I’m forgetting.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.