Trait Facet

Source
pub unsafe trait Facet<'a>: 'a {
    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.

§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

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 SHAPE: &'static Shape

Source§

impl Facet<'_> for SocketAddr

Source§

const SHAPE: &'static Shape

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 ()

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for String

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for Ipv4Addr

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for Ipv6Addr

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for RandomState

Source§

const SHAPE: &'static Shape

Source§

impl Facet<'_> for PathBuf

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

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 NonZero<i8>

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

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: Facet<'a> + Default + BuildHasher,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, R> Facet<'a> for fn() -> R
where R: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, R> Facet<'a> for extern "C" fn() -> R
where R: Facet<'a>,

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, R> Facet<'a> for fn(T0) -> R
where T0: Facet<'a>, R: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T0, R> Facet<'a> for extern "C" fn(T0) -> R
where T0: Facet<'a>, R: 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, R> Facet<'a> for fn(T0, T1) -> R
where T0: Facet<'a>, T1: Facet<'a>, R: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T0, T1, R> Facet<'a> for extern "C" fn(T0, T1) -> R
where T0: Facet<'a>, T1: Facet<'a>, R: 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, R> Facet<'a> for fn(T0, T1, T2) -> R
where T0: Facet<'a>, T1: Facet<'a>, T2: Facet<'a>, R: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T0, T1, T2, R> Facet<'a> for extern "C" fn(T0, T1, T2) -> R
where T0: Facet<'a>, T1: Facet<'a>, T2: Facet<'a>, R: 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, T0, T1, T2, T3, R> Facet<'a> for fn(T0, T1, T2, T3) -> R
where T0: Facet<'a>, T1: Facet<'a>, T2: Facet<'a>, T3: Facet<'a>, R: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T0, T1, T2, T3, R> Facet<'a> for extern "C" fn(T0, T1, T2, T3) -> R
where T0: Facet<'a>, T1: Facet<'a>, T2: Facet<'a>, T3: Facet<'a>, R: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T0, T1, T2, T3, T4, R> Facet<'a> for extern "C" fn(T0, T1, T2, T3, T4) -> R
where T0: Facet<'a>, T1: Facet<'a>, T2: Facet<'a>, T3: Facet<'a>, T4: Facet<'a>, R: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T0, T1, T2, T3, T4, T5, R> Facet<'a> for fn(T0, T1, T2, T3, T4, T5) -> R
where T0: Facet<'a>, T1: Facet<'a>, T2: Facet<'a>, T3: Facet<'a>, T4: Facet<'a>, T5: Facet<'a>, R: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T0, T1, T2, T3, T4, T5, R> Facet<'a> for extern "C" fn(T0, T1, T2, T3, T4, T5) -> R
where T0: Facet<'a>, T1: Facet<'a>, T2: Facet<'a>, T3: Facet<'a>, T4: Facet<'a>, T5: Facet<'a>, R: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T0, T1, T2, T3, T4, T5, T6, T7, T8> Facet<'a> for (T0, T1, T2, T3, T4, T5, T6, T7, T8)
where T0: Facet<'a>, T1: Facet<'a>, T2: Facet<'a>, T3: Facet<'a>, T4: Facet<'a>, T5: Facet<'a>, T6: Facet<'a>, T7: Facet<'a>, T8: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> Facet<'a> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
where T0: Facet<'a>, T1: Facet<'a>, T2: Facet<'a>, T3: Facet<'a>, T4: Facet<'a>, T5: Facet<'a>, T6: Facet<'a>, T7: Facet<'a>, T8: Facet<'a>, T9: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Facet<'a> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
where T0: Facet<'a>, T1: Facet<'a>, T2: Facet<'a>, T3: Facet<'a>, T4: Facet<'a>, T5: Facet<'a>, T6: Facet<'a>, T7: Facet<'a>, T8: Facet<'a>, T9: Facet<'a>, T10: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Facet<'a> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
where T0: Facet<'a>, T1: Facet<'a>, T2: Facet<'a>, T3: Facet<'a>, T4: Facet<'a>, T5: Facet<'a>, T6: Facet<'a>, T7: Facet<'a>, T8: Facet<'a>, T9: Facet<'a>, T10: Facet<'a>, T11: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

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: ?Sized + 'a> Facet<'a> for PhantomData<T>

Source§

const SHAPE: &'static Shape

Implementors§

Source§

impl Facet<'_> for ConstTypeId

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape