facet_core/impls/internal/
def.rs

1//! Facet implementation for Def and related types
2
3use crate::{Def, Facet, Shape, ShapeBuilder, Type, UserType, VTableDirect, vtable_direct};
4
5// Def - treat as opaque (complex enum with many variants containing recursive Shape references)
6unsafe impl Facet<'_> for Def {
7    const SHAPE: &'static Shape = &const {
8        const VTABLE: VTableDirect = vtable_direct!(Def => Debug,);
9
10        ShapeBuilder::for_sized::<Def>("Def")
11            .ty(Type::User(UserType::Opaque))
12            .def(Def::Scalar)
13            .vtable_direct(&VTABLE)
14            .copy()
15            .send()
16            .sync()
17            .build()
18    };
19}
20
21// MapDef - treat as opaque
22unsafe impl Facet<'_> for crate::MapDef {
23    const SHAPE: &'static Shape = &const {
24        const VTABLE: VTableDirect = vtable_direct!(crate::MapDef => Debug,);
25
26        ShapeBuilder::for_sized::<crate::MapDef>("MapDef")
27            .ty(Type::User(UserType::Opaque))
28            .def(Def::Scalar)
29            .vtable_direct(&VTABLE)
30            .copy()
31            .send()
32            .sync()
33            .build()
34    };
35}
36
37// SetDef - treat as opaque
38unsafe impl Facet<'_> for crate::SetDef {
39    const SHAPE: &'static Shape = &const {
40        const VTABLE: VTableDirect = vtable_direct!(crate::SetDef => Debug,);
41
42        ShapeBuilder::for_sized::<crate::SetDef>("SetDef")
43            .ty(Type::User(UserType::Opaque))
44            .def(Def::Scalar)
45            .vtable_direct(&VTABLE)
46            .copy()
47            .send()
48            .sync()
49            .build()
50    };
51}
52
53// ListDef - treat as opaque
54unsafe impl Facet<'_> for crate::ListDef {
55    const SHAPE: &'static Shape = &const {
56        const VTABLE: VTableDirect = vtable_direct!(crate::ListDef => Debug,);
57
58        ShapeBuilder::for_sized::<crate::ListDef>("ListDef")
59            .ty(Type::User(UserType::Opaque))
60            .def(Def::Scalar)
61            .vtable_direct(&VTABLE)
62            .copy()
63            .send()
64            .sync()
65            .build()
66    };
67}
68
69// ArrayDef - treat as opaque
70unsafe impl Facet<'_> for crate::ArrayDef {
71    const SHAPE: &'static Shape = &const {
72        const VTABLE: VTableDirect = vtable_direct!(crate::ArrayDef => Debug,);
73
74        ShapeBuilder::for_sized::<crate::ArrayDef>("ArrayDef")
75            .ty(Type::User(UserType::Opaque))
76            .def(Def::Scalar)
77            .vtable_direct(&VTABLE)
78            .copy()
79            .send()
80            .sync()
81            .build()
82    };
83}
84
85// NdArrayDef - treat as opaque
86unsafe impl Facet<'_> for crate::NdArrayDef {
87    const SHAPE: &'static Shape = &const {
88        const VTABLE: VTableDirect = vtable_direct!(crate::NdArrayDef => Debug,);
89
90        ShapeBuilder::for_sized::<crate::NdArrayDef>("NdArrayDef")
91            .ty(Type::User(UserType::Opaque))
92            .def(Def::Scalar)
93            .vtable_direct(&VTABLE)
94            .copy()
95            .send()
96            .sync()
97            .build()
98    };
99}
100
101// SliceDef - treat as opaque
102unsafe impl Facet<'_> for crate::SliceDef {
103    const SHAPE: &'static Shape = &const {
104        const VTABLE: VTableDirect = vtable_direct!(crate::SliceDef => Debug,);
105
106        ShapeBuilder::for_sized::<crate::SliceDef>("SliceDef")
107            .ty(Type::User(UserType::Opaque))
108            .def(Def::Scalar)
109            .vtable_direct(&VTABLE)
110            .copy()
111            .send()
112            .sync()
113            .build()
114    };
115}
116
117// OptionDef - treat as opaque
118unsafe impl Facet<'_> for crate::OptionDef {
119    const SHAPE: &'static Shape = &const {
120        const VTABLE: VTableDirect = vtable_direct!(crate::OptionDef => Debug,);
121
122        ShapeBuilder::for_sized::<crate::OptionDef>("OptionDef")
123            .ty(Type::User(UserType::Opaque))
124            .def(Def::Scalar)
125            .vtable_direct(&VTABLE)
126            .copy()
127            .send()
128            .sync()
129            .build()
130    };
131}
132
133// ResultDef - treat as opaque
134unsafe impl Facet<'_> for crate::ResultDef {
135    const SHAPE: &'static Shape = &const {
136        const VTABLE: VTableDirect = vtable_direct!(crate::ResultDef => Debug,);
137
138        ShapeBuilder::for_sized::<crate::ResultDef>("ResultDef")
139            .ty(Type::User(UserType::Opaque))
140            .def(Def::Scalar)
141            .vtable_direct(&VTABLE)
142            .copy()
143            .send()
144            .sync()
145            .build()
146    };
147}
148
149// PointerDef - treat as opaque
150unsafe impl Facet<'_> for crate::PointerDef {
151    const SHAPE: &'static Shape = &const {
152        const VTABLE: VTableDirect = vtable_direct!(crate::PointerDef => Debug,);
153
154        ShapeBuilder::for_sized::<crate::PointerDef>("PointerDef")
155            .ty(Type::User(UserType::Opaque))
156            .def(Def::Scalar)
157            .vtable_direct(&VTABLE)
158            .copy()
159            .send()
160            .sync()
161            .build()
162    };
163}
164
165// DynamicValueDef - treat as opaque
166unsafe impl Facet<'_> for crate::DynamicValueDef {
167    const SHAPE: &'static Shape = &const {
168        const VTABLE: VTableDirect = vtable_direct!(crate::DynamicValueDef => Debug,);
169
170        ShapeBuilder::for_sized::<crate::DynamicValueDef>("DynamicValueDef")
171            .ty(Type::User(UserType::Opaque))
172            .def(Def::Scalar)
173            .vtable_direct(&VTABLE)
174            .copy()
175            .send()
176            .sync()
177            .build()
178    };
179}