Facet

Trait Facet 

Source
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§

Source

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.

Implementations on Foreign Types§

Source§

impl Facet<'_> for bool

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for char

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for f32

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for f64

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for str

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for ()

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for String

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for TypeId

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for RandomState

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for Path

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for PathBuf

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for i8

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for i16

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for i32

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for i64

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for i128

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for isize

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for u8

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for u16

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for u32

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for u64

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for u128

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for usize

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for Rc<str>

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for Weak<str>

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for Arc<str>

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for Weak<str>

Source§

const SHAPE: &'static Shape

Source§

impl<'a, Idx: Facet<'a>> Facet<'a> for Range<Idx>

Source§

const SHAPE: &'static Shape

Source§

impl<'a, K, V> Facet<'a> for BTreeMap<K, V>
where K: Facet<'a> + Eq + Ord + 'static, V: Facet<'a> + 'static,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, K, V, S> Facet<'a> for HashMap<K, V, S>
where K: Facet<'a> + Eq + Hash, V: Facet<'a>, S: 'a + Default + BuildHasher,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T0> Facet<'a> for (T0,)
where T0: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T0, T1> Facet<'a> for (T0, T1)
where T0: Facet<'a>, T1: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T0, T1, T2> Facet<'a> for (T0, T1, T2)
where T0: Facet<'a>, T1: Facet<'a>, T2: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T0, T1, T2, T3> Facet<'a> for (T0, T1, T2, T3)
where T0: Facet<'a>, T1: Facet<'a>, T2: Facet<'a>, T3: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T> Facet<'a> for Cow<'a, T>
where T: 'a + ?Sized + ToOwned + 'static + Facet<'a>, T::Owned: Facet<'static>,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T> Facet<'a> for [T]
where T: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T> Facet<'a> for BTreeSet<T>
where T: Facet<'a> + Eq + Ord + 'static,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T> Facet<'a> for Vec<T>
where T: Facet<'a> + 'static,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T, S> Facet<'a> for HashSet<T, S>
where T: Facet<'a> + Eq + Hash + 'static, S: Facet<'a> + Default + BuildHasher + 'static,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T, const N: usize> Facet<'a> for [T; N]
where T: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T: Facet<'a> + ?Sized> Facet<'a> for *const T

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T: Facet<'a> + ?Sized> Facet<'a> for *mut T

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T: Facet<'a>> Facet<'a> for Option<T>

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T: Facet<'a>> Facet<'a> for Rc<T>

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T: Facet<'a>> Facet<'a> for Weak<T>

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T: Facet<'a>> Facet<'a> for Arc<T>

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T: Facet<'a>> Facet<'a> for Weak<T>

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T: Facet<'a>> Facet<'a> for NonNull<T>

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T: Facet<'a>, E: Facet<'a>> Facet<'a> for Result<T, E>

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T: ?Sized + 'a> Facet<'a> for PhantomData<T>

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T: ?Sized + Facet<'a>> Facet<'a> for &'a T

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T: ?Sized + Facet<'a>> Facet<'a> for &'a mut T

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T: ?Sized + Facet<'a>> Facet<'a> for Box<T>

Source§

const SHAPE: &'static Shape

Source§

impl<'a, U: Facet<'a>> Facet<'a> for Rc<[U]>

Source§

const SHAPE: &'static Shape

Source§

impl<'a, U: Facet<'a>> Facet<'a> for Weak<[U]>

Source§

const SHAPE: &'static Shape

Source§

impl<'a, U: Facet<'a>> Facet<'a> for Arc<[U]>

Source§

const SHAPE: &'static Shape

Source§

impl<'a, U: Facet<'a>> Facet<'a> for Weak<[U]>

Source§

const SHAPE: &'static Shape

Implementors§

Source§

impl Facet<'_> for BaseRepr

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for Def

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for NumericType

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for PointerType

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for PrimitiveType

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for SequenceType

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for ShapeLayout

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for TextualType

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for Type

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for UserType

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for VTableErased

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for ArrayDef

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for ArrayType

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for Attr

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for ConstTypeId

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for DynamicValueDef

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for EnumType

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for FunctionPointerDef

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for ListDef

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for MapDef

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for MarkerTraits

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for NdArrayDef

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for OptionDef

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for PointerDef

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for Repr

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for ResultDef

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for SetDef

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for Shape

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for SliceDef

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for SliceType

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for StructType

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for TypeParam

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for UnionType

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for ValuePointerType

Source§

const SHAPE: &'static Shape

Source§

impl<'facet, T: 'facet> Facet<'facet> for Opaque<T>

Source§

const SHAPE: &'static Shape