facet_core/impls/internal/
shape.rs

1//! Facet implementation for Shape
2
3use crate::{Def, Facet, Shape, ShapeBuilder, Type, UserType, VTableDirect, vtable_direct};
4
5// Shape - treat as opaque for now
6// It contains many reference types (&'static str, &'static [T], etc.)
7// that would require implementing Facet for those reference types.
8// We can expand this later when we have proper support for reference types.
9unsafe impl Facet<'_> for Shape {
10    const SHAPE: &'static Shape = &const {
11        const VTABLE: VTableDirect = vtable_direct!(Shape =>
12            Debug,
13            Hash,
14            PartialEq,
15            PartialOrd,
16            Ord,
17        );
18
19        ShapeBuilder::for_sized::<Shape>("Shape")
20            .ty(Type::User(UserType::Opaque))
21            .def(Def::Scalar)
22            .vtable_direct(&VTABLE)
23            .eq()
24            .send()
25            .sync()
26            .build()
27    };
28}