Facet

Trait Facet 

Source
pub unsafe trait Facet<'facet>: 'facet {
    const SHAPE: &'static Shape;
    const VTABLE: &'static ValueVTable;
}
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

Shape embeds all other constants of this trait.

Source

const VTABLE: &'static ValueVTable

Function pointers to perform various operations: print the full type name (with generic type parameters), use the Display implementation, the Debug implementation, build a default value, clone, etc.

If Self::SHAPE has ShapeLayout::Unsized, then the parent pointer needs to be passed.

There are more specific vtables in variants of Def

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 IpAddr

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for SocketAddr

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for bool

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for char

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for f32

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for f64

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for str

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for ()

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for String

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for TypeId

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for Ipv4Addr

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for Ipv6Addr

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for RandomState

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for Path

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for PathBuf

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for &'a mut str

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

impl<'a> Facet<'a> for Cow<'a, str>

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

const VTABLE: &'static ValueVTable

Source§

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

Source§

const VTABLE: &'static ValueVTable

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 VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

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 VTABLE: &'static ValueVTable

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 VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Implementors§

Source§

impl Facet<'_> for ConstTypeId

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const VTABLE: &'static ValueVTable

Source§

const SHAPE: &'static Shape