Trait Facet

Source
pub unsafe trait Facet<'a>: Sized + 'a {
    const SHAPE: &'static Shape;

    // Provided method
    fn type_eq<Other>() -> bool
       where Other: Facet<'a> { ... }
}
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

Provided Methods§

Source

fn type_eq<Other>() -> bool
where Other: Facet<'a>,

Returns true if the type of self is equal to the type of other

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 Facet<'_> for Utf8PathBuf

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 &'a Utf8Path

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,

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 Option<T>
where T: Facet<'a>,

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

impl<'a, T> Facet<'a> for NonNull<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<'facet, R> Facet<'facet> for fn() -> R
where R: Facet<'facet>,

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

impl<'facet, R, T0, T1> Facet<'facet> for fn(T0, T1) -> R
where T0: Facet<'facet>, T1: Facet<'facet>, R: Facet<'facet>,

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Implementors§

Source§

impl Facet<'_> for ConstTypeId

Source§

const SHAPE: &'static Shape

Source§

impl<'__facet> Facet<'__facet> for KitchenSinkEnum

Source§

const SHAPE: &'static Shape

Source§

impl<'__facet> Facet<'__facet> for SubEnum

Source§

const SHAPE: &'static Shape

Source§

impl<'__facet> Facet<'__facet> for KitchenSinkStruct

Source§

const SHAPE: &'static Shape

Source§

impl<'__facet> Facet<'__facet> for Point

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape