Trait Facet

Source
pub unsafe trait Facet: Sized {
    const SHAPE: &'static Shape;

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

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 &str

Source§

const SHAPE: &'static Shape

Source§

impl Facet for &Path

Source§

const SHAPE: &'static Shape

Source§

impl Facet for Cow<'_, str>

Source§

const SHAPE: &'static Shape

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 i8

Source§

const SHAPE: &'static Shape

Source§

impl Facet for i16

Source§

const SHAPE: &'static Shape

Source§

impl Facet for i32

Source§

const SHAPE: &'static Shape

Source§

impl Facet for i64

Source§

const SHAPE: &'static Shape

Source§

impl Facet for i128

Source§

const SHAPE: &'static Shape

Source§

impl Facet for isize

Source§

const SHAPE: &'static Shape

Source§

impl Facet for u8

Source§

const SHAPE: &'static Shape

Source§

impl Facet for u16

Source§

const SHAPE: &'static Shape

Source§

impl Facet for u32

Source§

const SHAPE: &'static Shape

Source§

impl Facet for u64

Source§

const SHAPE: &'static Shape

Source§

impl Facet for u128

Source§

const SHAPE: &'static Shape

Source§

impl Facet for ()

Source§

const SHAPE: &'static Shape

Source§

impl Facet for usize

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

Source§

const SHAPE: &'static Shape

Source§

impl Facet for NonZero<i16>

Source§

const SHAPE: &'static Shape

Source§

impl Facet for NonZero<i32>

Source§

const SHAPE: &'static Shape

Source§

impl Facet for NonZero<i64>

Source§

const SHAPE: &'static Shape

Source§

impl Facet for NonZero<i128>

Source§

const SHAPE: &'static Shape

Source§

impl Facet for NonZero<isize>

Source§

const SHAPE: &'static Shape

Source§

impl Facet for NonZero<u8>

Source§

const SHAPE: &'static Shape

Source§

impl Facet for NonZero<u16>

Source§

const SHAPE: &'static Shape

Source§

impl Facet for NonZero<u32>

Source§

const SHAPE: &'static Shape

Source§

impl Facet for NonZero<u64>

Source§

const SHAPE: &'static Shape

Source§

impl Facet for NonZero<u128>

Source§

const SHAPE: &'static Shape

Source§

impl Facet for NonZero<usize>

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<K, V> Facet for BTreeMap<K, V>
where K: Facet + Eq + Ord + 'static, V: Facet + 'static,

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

impl<T> Facet for Option<T>
where T: Facet,

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Source§

impl<T> Facet for PhantomData<T>
where T: ?Sized,

Source§

const SHAPE: &'static Shape

Source§

impl<T> Facet for NonNull<T>
where T: Facet,

Source§

const SHAPE: &'static Shape

Source§

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

Source§

const SHAPE: &'static Shape

Implementors§

Source§

impl Facet for KitchenSinkEnum

Source§

const SHAPE: &'static Shape

Source§

impl Facet for SubEnum

Source§

const SHAPE: &'static Shape

Source§

impl Facet for KitchenSinkStruct

Source§

const SHAPE: &'static Shape

Source§

impl Facet for Point

Source§

const SHAPE: &'static Shape

Source§

impl Facet for ConstTypeId

Source§

const SHAPE: &'static Shape

Source§

impl<T> Facet for Opaque<Arc<T>>

Source§

const SHAPE: &'static Shape