facet/sample_generated_code.rs
1//! This defines a few types showcasing various features of the Facet derive macro.
2#![allow(warnings)]
3#[prelude_import]
4use std::prelude::rust_2024::*;
5extern crate std;
6
7use crate::Facet;
8
9/// A struct demonstrating various field types and attributes.
10pub struct KitchenSinkStruct {
11 /// A basic string field.
12 pub basic_field: String,
13 /// A field marked as sensitive.
14 pub sensitive_field: u64,
15 /// A tuple field.
16 pub tuple_field: (i32, bool),
17 /// An array field.
18 pub array_field: [u8; 4],
19 /// A static slice field.
20 pub slice_field: &'static [u8],
21 /// A vector field.
22 pub vec_field: Vec<f32>,
23 /// A field containing another struct that derives Facet.
24 pub nested_struct_field: Point,
25}
26#[used]
27static KITCHEN_SINK_STRUCT_SHAPE: &'static crate::Shape =
28 <KitchenSinkStruct as crate::Facet>::SHAPE;
29#[automatically_derived]
30unsafe impl<'__facet> crate::Facet<'__facet> for KitchenSinkStruct {
31 const SHAPE: &'static crate::Shape = &const {
32 let fields: &'static [crate::Field] = &const {
33 [
34 crate::Field::builder()
35 .name("basic_field")
36 .shape(|| crate::shape_of(&(|s: &KitchenSinkStruct| &s.basic_field)))
37 .offset({
38 builtin # offset_of(KitchenSinkStruct, basic_field)
39 })
40 .flags(crate::FieldFlags::EMPTY)
41 .attributes(&const { [] })
42 .doc(&[" A basic string field."])
43 .build(),
44 crate::Field::builder()
45 .name("sensitive_field")
46 .shape(|| crate::shape_of(&(|s: &KitchenSinkStruct| &s.sensitive_field)))
47 .offset({
48 builtin # offset_of(KitchenSinkStruct, sensitive_field)
49 })
50 .flags(crate::FieldFlags::SENSITIVE)
51 .attributes(&const { [crate::FieldAttribute::Sensitive] })
52 .doc(&[" A field marked as sensitive."])
53 .build(),
54 crate::Field::builder()
55 .name("tuple_field")
56 .shape(|| crate::shape_of(&(|s: &KitchenSinkStruct| &s.tuple_field)))
57 .offset({
58 builtin # offset_of(KitchenSinkStruct, tuple_field)
59 })
60 .flags(crate::FieldFlags::EMPTY)
61 .attributes(&const { [] })
62 .doc(&[" A tuple field."])
63 .build(),
64 crate::Field::builder()
65 .name("array_field")
66 .shape(|| crate::shape_of(&(|s: &KitchenSinkStruct| &s.array_field)))
67 .offset({
68 builtin # offset_of(KitchenSinkStruct, array_field)
69 })
70 .flags(crate::FieldFlags::EMPTY)
71 .attributes(&const { [] })
72 .doc(&[" An array field."])
73 .build(),
74 crate::Field::builder()
75 .name("slice_field")
76 .shape(|| crate::shape_of(&(|s: &KitchenSinkStruct| &s.slice_field)))
77 .offset({
78 builtin # offset_of(KitchenSinkStruct, slice_field)
79 })
80 .flags(crate::FieldFlags::EMPTY)
81 .attributes(&const { [] })
82 .doc(&[" A static slice field."])
83 .build(),
84 crate::Field::builder()
85 .name("vec_field")
86 .shape(|| crate::shape_of(&(|s: &KitchenSinkStruct| &s.vec_field)))
87 .offset({
88 builtin # offset_of(KitchenSinkStruct, vec_field)
89 })
90 .flags(crate::FieldFlags::EMPTY)
91 .attributes(&const { [] })
92 .doc(&[" A vector field."])
93 .build(),
94 crate::Field::builder()
95 .name("nested_struct_field")
96 .shape(|| crate::shape_of(&(|s: &KitchenSinkStruct| &s.nested_struct_field)))
97 .offset({
98 builtin # offset_of(KitchenSinkStruct, nested_struct_field)
99 })
100 .flags(crate::FieldFlags::EMPTY)
101 .attributes(&const { [] })
102 .doc(&[" A field containing another struct that derives Facet."])
103 .build(),
104 ]
105 };
106 let vtable = &const {
107 let mut vtable = const {
108 let mut builder = ::facet_core::ValueVTable::builder()
109 .type_name(|f, _opts| ::core::fmt::Write::write_str(f, "KitchenSinkStruct"))
110 .drop_in_place(|data| unsafe { data.drop_in_place::<Self>() });
111 if {
112 /// Fallback trait with `False` for `IMPLS` if the type does not
113 /// implement the given trait.
114 trait DoesNotImpl {
115 const IMPLS: bool = false;
116 }
117 impl<T: ?Sized> DoesNotImpl for T {}
118 /// Concrete type with `True` for `IMPLS` if the type implements the
119 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
120 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
121 #[allow(dead_code)]
122 impl<T: ?Sized + core::fmt::Display> Wrapper<T> {
123 const IMPLS: bool = true;
124 }
125 <Wrapper<Self>>::IMPLS
126 } {
127 builder = builder.display(|data, f| {
128 use ::facet_core::spez::*;
129 (&&Spez(unsafe { data.get::<Self>() })).spez_display(f)
130 });
131 }
132 if {
133 /// Fallback trait with `False` for `IMPLS` if the type does not
134 /// implement the given trait.
135 trait DoesNotImpl {
136 const IMPLS: bool = false;
137 }
138 impl<T: ?Sized> DoesNotImpl for T {}
139 /// Concrete type with `True` for `IMPLS` if the type implements the
140 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
141 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
142 #[allow(dead_code)]
143 impl<T: ?Sized + core::fmt::Debug> Wrapper<T> {
144 const IMPLS: bool = true;
145 }
146 <Wrapper<Self>>::IMPLS
147 } {
148 builder = builder.debug(|data, f| {
149 use ::facet_core::spez::*;
150 (&&Spez(unsafe { data.get::<Self>() })).spez_debug(f)
151 });
152 }
153 if {
154 /// Fallback trait with `False` for `IMPLS` if the type does not
155 /// implement the given trait.
156 trait DoesNotImpl {
157 const IMPLS: bool = false;
158 }
159 impl<T: ?Sized> DoesNotImpl for T {}
160 /// Concrete type with `True` for `IMPLS` if the type implements the
161 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
162 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
163 #[allow(dead_code)]
164 impl<T: ?Sized + core::default::Default> Wrapper<T> {
165 const IMPLS: bool = true;
166 }
167 <Wrapper<Self>>::IMPLS
168 } {
169 builder = builder.default_in_place(|target| {
170 use ::facet_core::spez::*;
171 unsafe { (&&SpezEmpty::<Self>::SPEZ).spez_default_in_place(target) }
172 });
173 }
174 if {
175 /// Fallback trait with `False` for `IMPLS` if the type does not
176 /// implement the given trait.
177 trait DoesNotImpl {
178 const IMPLS: bool = false;
179 }
180 impl<T: ?Sized> DoesNotImpl for T {}
181 /// Concrete type with `True` for `IMPLS` if the type implements the
182 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
183 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
184 #[allow(dead_code)]
185 impl<T: ?Sized + core::clone::Clone> Wrapper<T> {
186 const IMPLS: bool = true;
187 }
188 <Wrapper<Self>>::IMPLS
189 } {
190 builder = builder.clone_into(|src, dst| {
191 use ::facet_core::spez::*;
192 unsafe { (&&Spez(src.get::<Self>())).spez_clone_into(dst) }
193 });
194 }
195 {
196 let mut traits = ::facet_core::MarkerTraits::empty();
197 if {
198 /// Fallback trait with `False` for `IMPLS` if the type does not
199 /// implement the given trait.
200 trait DoesNotImpl {
201 const IMPLS: bool = false;
202 }
203 impl<T: ?Sized> DoesNotImpl for T {}
204 /// Concrete type with `True` for `IMPLS` if the type implements the
205 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
206 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
207 #[allow(dead_code)]
208 impl<T: ?Sized + core::cmp::Eq> Wrapper<T> {
209 const IMPLS: bool = true;
210 }
211 <Wrapper<Self>>::IMPLS
212 } {
213 traits = traits.union(::facet_core::MarkerTraits::EQ);
214 }
215 if {
216 /// Fallback trait with `False` for `IMPLS` if the type does not
217 /// implement the given trait.
218 trait DoesNotImpl {
219 const IMPLS: bool = false;
220 }
221 impl<T: ?Sized> DoesNotImpl for T {}
222 /// Concrete type with `True` for `IMPLS` if the type implements the
223 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
224 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
225 #[allow(dead_code)]
226 impl<T: ?Sized + core::marker::Send> Wrapper<T> {
227 const IMPLS: bool = true;
228 }
229 <Wrapper<Self>>::IMPLS
230 } {
231 traits = traits.union(::facet_core::MarkerTraits::SEND);
232 }
233 if {
234 /// Fallback trait with `False` for `IMPLS` if the type does not
235 /// implement the given trait.
236 trait DoesNotImpl {
237 const IMPLS: bool = false;
238 }
239 impl<T: ?Sized> DoesNotImpl for T {}
240 /// Concrete type with `True` for `IMPLS` if the type implements the
241 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
242 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
243 #[allow(dead_code)]
244 impl<T: ?Sized + core::marker::Sync> Wrapper<T> {
245 const IMPLS: bool = true;
246 }
247 <Wrapper<Self>>::IMPLS
248 } {
249 traits = traits.union(::facet_core::MarkerTraits::SYNC);
250 }
251 if {
252 /// Fallback trait with `False` for `IMPLS` if the type does not
253 /// implement the given trait.
254 trait DoesNotImpl {
255 const IMPLS: bool = false;
256 }
257 impl<T: ?Sized> DoesNotImpl for T {}
258 /// Concrete type with `True` for `IMPLS` if the type implements the
259 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
260 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
261 #[allow(dead_code)]
262 impl<T: ?Sized + core::marker::Copy> Wrapper<T> {
263 const IMPLS: bool = true;
264 }
265 <Wrapper<Self>>::IMPLS
266 } {
267 traits = traits.union(::facet_core::MarkerTraits::COPY);
268 }
269 if {
270 /// Fallback trait with `False` for `IMPLS` if the type does not
271 /// implement the given trait.
272 trait DoesNotImpl {
273 const IMPLS: bool = false;
274 }
275 impl<T: ?Sized> DoesNotImpl for T {}
276 /// Concrete type with `True` for `IMPLS` if the type implements the
277 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
278 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
279 #[allow(dead_code)]
280 impl<T: ?Sized + core::marker::Unpin> Wrapper<T> {
281 const IMPLS: bool = true;
282 }
283 <Wrapper<Self>>::IMPLS
284 } {
285 traits = traits.union(::facet_core::MarkerTraits::UNPIN);
286 }
287 builder = builder.marker_traits(traits);
288 }
289 if {
290 /// Fallback trait with `False` for `IMPLS` if the type does not
291 /// implement the given trait.
292 trait DoesNotImpl {
293 const IMPLS: bool = false;
294 }
295 impl<T: ?Sized> DoesNotImpl for T {}
296 /// Concrete type with `True` for `IMPLS` if the type implements the
297 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
298 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
299 #[allow(dead_code)]
300 impl<T: ?Sized + core::cmp::PartialEq> Wrapper<T> {
301 const IMPLS: bool = true;
302 }
303 <Wrapper<Self>>::IMPLS
304 } {
305 builder = builder.eq(|left, right| {
306 use ::facet_core::spez::*;
307 (&&Spez(unsafe { left.get::<Self>() }))
308 .spez_eq(&&Spez(unsafe { right.get::<Self>() }))
309 });
310 }
311 if {
312 /// Fallback trait with `False` for `IMPLS` if the type does not
313 /// implement the given trait.
314 trait DoesNotImpl {
315 const IMPLS: bool = false;
316 }
317 impl<T: ?Sized> DoesNotImpl for T {}
318 /// Concrete type with `True` for `IMPLS` if the type implements the
319 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
320 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
321 #[allow(dead_code)]
322 impl<T: ?Sized + core::cmp::PartialOrd> Wrapper<T> {
323 const IMPLS: bool = true;
324 }
325 <Wrapper<Self>>::IMPLS
326 } {
327 builder = builder.partial_ord(|left, right| {
328 use ::facet_core::spez::*;
329 (&&Spez(unsafe { left.get::<Self>() }))
330 .spez_partial_cmp(&&Spez(unsafe { right.get::<Self>() }))
331 });
332 }
333 if {
334 /// Fallback trait with `False` for `IMPLS` if the type does not
335 /// implement the given trait.
336 trait DoesNotImpl {
337 const IMPLS: bool = false;
338 }
339 impl<T: ?Sized> DoesNotImpl for T {}
340 /// Concrete type with `True` for `IMPLS` if the type implements the
341 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
342 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
343 #[allow(dead_code)]
344 impl<T: ?Sized + core::cmp::Ord> Wrapper<T> {
345 const IMPLS: bool = true;
346 }
347 <Wrapper<Self>>::IMPLS
348 } {
349 builder = builder.ord(|left, right| {
350 use ::facet_core::spez::*;
351 (&&Spez(unsafe { left.get::<Self>() }))
352 .spez_cmp(&&Spez(unsafe { right.get::<Self>() }))
353 });
354 }
355 if {
356 /// Fallback trait with `False` for `IMPLS` if the type does not
357 /// implement the given trait.
358 trait DoesNotImpl {
359 const IMPLS: bool = false;
360 }
361 impl<T: ?Sized> DoesNotImpl for T {}
362 /// Concrete type with `True` for `IMPLS` if the type implements the
363 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
364 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
365 #[allow(dead_code)]
366 impl<T: ?Sized + core::hash::Hash> Wrapper<T> {
367 const IMPLS: bool = true;
368 }
369 <Wrapper<Self>>::IMPLS
370 } {
371 builder = builder.hash(|value, hasher_this, hasher_write_fn| {
372 use ::facet_core::HasherProxy;
373 use ::facet_core::spez::*;
374 (&&Spez(unsafe { value.get::<Self>() })).spez_hash(&mut unsafe {
375 HasherProxy::new(hasher_this, hasher_write_fn)
376 })
377 });
378 }
379 if {
380 /// Fallback trait with `False` for `IMPLS` if the type does not
381 /// implement the given trait.
382 trait DoesNotImpl {
383 const IMPLS: bool = false;
384 }
385 impl<T: ?Sized> DoesNotImpl for T {}
386 /// Concrete type with `True` for `IMPLS` if the type implements the
387 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
388 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
389 #[allow(dead_code)]
390 impl<T: ?Sized + core::str::FromStr> Wrapper<T> {
391 const IMPLS: bool = true;
392 }
393 <Wrapper<Self>>::IMPLS
394 } {
395 builder = builder.parse(|s, target| {
396 use ::facet_core::spez::*;
397 let res = unsafe { (&&SpezEmpty::<Self>::SPEZ).spez_parse(s, target) };
398 res.map(|_| unsafe { target.assume_init() })
399 });
400 }
401 builder.build()
402 };
403 vtable
404 };
405 crate::Shape::builder()
406 .id(crate::ConstTypeId::of::<Self>())
407 .layout(::core::alloc::Layout::new::<Self>())
408 .vtable(vtable)
409 .def(crate::Def::Struct(
410 crate::Struct::builder()
411 .kind(crate::StructKind::Struct)
412 .fields(fields)
413 .build(),
414 ))
415 .doc(&[" A struct demonstrating various field types and attributes."])
416 .build()
417 };
418}
419/// A simple point struct, also deriving Facet.
420pub struct Point {
421 pub x: f32,
422 pub y: f32,
423 /// Nested sensitive data within the struct.
424 pub metadata: String,
425}
426#[used]
427static POINT_SHAPE: &'static crate::Shape = <Point as crate::Facet>::SHAPE;
428#[automatically_derived]
429unsafe impl<'__facet> crate::Facet<'__facet> for Point {
430 const SHAPE: &'static crate::Shape = &const {
431 let fields: &'static [crate::Field] = &const {
432 [
433 crate::Field::builder()
434 .name("x")
435 .shape(|| crate::shape_of(&(|s: &Point| &s.x)))
436 .offset({
437 builtin # offset_of(Point, x)
438 })
439 .flags(crate::FieldFlags::EMPTY)
440 .attributes(&const { [] })
441 .build(),
442 crate::Field::builder()
443 .name("y")
444 .shape(|| crate::shape_of(&(|s: &Point| &s.y)))
445 .offset({
446 builtin # offset_of(Point, y)
447 })
448 .flags(crate::FieldFlags::EMPTY)
449 .attributes(&const { [] })
450 .build(),
451 crate::Field::builder()
452 .name("metadata")
453 .shape(|| crate::shape_of(&(|s: &Point| &s.metadata)))
454 .offset({
455 builtin # offset_of(Point, metadata)
456 })
457 .flags(crate::FieldFlags::SENSITIVE)
458 .attributes(&const { [crate::FieldAttribute::Sensitive] })
459 .doc(&[" Nested sensitive data within the struct."])
460 .build(),
461 ]
462 };
463 let vtable = &const {
464 let mut vtable = const {
465 let mut builder = ::facet_core::ValueVTable::builder()
466 .type_name(|f, _opts| ::core::fmt::Write::write_str(f, "Point"))
467 .drop_in_place(|data| unsafe { data.drop_in_place::<Self>() });
468 if {
469 /// Fallback trait with `False` for `IMPLS` if the type does not
470 /// implement the given trait.
471 trait DoesNotImpl {
472 const IMPLS: bool = false;
473 }
474 impl<T: ?Sized> DoesNotImpl for T {}
475 /// Concrete type with `True` for `IMPLS` if the type implements the
476 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
477 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
478 #[allow(dead_code)]
479 impl<T: ?Sized + core::fmt::Display> Wrapper<T> {
480 const IMPLS: bool = true;
481 }
482 <Wrapper<Self>>::IMPLS
483 } {
484 builder = builder.display(|data, f| {
485 use ::facet_core::spez::*;
486 (&&Spez(unsafe { data.get::<Self>() })).spez_display(f)
487 });
488 }
489 if {
490 /// Fallback trait with `False` for `IMPLS` if the type does not
491 /// implement the given trait.
492 trait DoesNotImpl {
493 const IMPLS: bool = false;
494 }
495 impl<T: ?Sized> DoesNotImpl for T {}
496 /// Concrete type with `True` for `IMPLS` if the type implements the
497 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
498 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
499 #[allow(dead_code)]
500 impl<T: ?Sized + core::fmt::Debug> Wrapper<T> {
501 const IMPLS: bool = true;
502 }
503 <Wrapper<Self>>::IMPLS
504 } {
505 builder = builder.debug(|data, f| {
506 use ::facet_core::spez::*;
507 (&&Spez(unsafe { data.get::<Self>() })).spez_debug(f)
508 });
509 }
510 if {
511 /// Fallback trait with `False` for `IMPLS` if the type does not
512 /// implement the given trait.
513 trait DoesNotImpl {
514 const IMPLS: bool = false;
515 }
516 impl<T: ?Sized> DoesNotImpl for T {}
517 /// Concrete type with `True` for `IMPLS` if the type implements the
518 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
519 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
520 #[allow(dead_code)]
521 impl<T: ?Sized + core::default::Default> Wrapper<T> {
522 const IMPLS: bool = true;
523 }
524 <Wrapper<Self>>::IMPLS
525 } {
526 builder = builder.default_in_place(|target| {
527 use ::facet_core::spez::*;
528 unsafe { (&&SpezEmpty::<Self>::SPEZ).spez_default_in_place(target) }
529 });
530 }
531 if {
532 /// Fallback trait with `False` for `IMPLS` if the type does not
533 /// implement the given trait.
534 trait DoesNotImpl {
535 const IMPLS: bool = false;
536 }
537 impl<T: ?Sized> DoesNotImpl for T {}
538 /// Concrete type with `True` for `IMPLS` if the type implements the
539 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
540 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
541 #[allow(dead_code)]
542 impl<T: ?Sized + core::clone::Clone> Wrapper<T> {
543 const IMPLS: bool = true;
544 }
545 <Wrapper<Self>>::IMPLS
546 } {
547 builder = builder.clone_into(|src, dst| {
548 use ::facet_core::spez::*;
549 unsafe { (&&Spez(src.get::<Self>())).spez_clone_into(dst) }
550 });
551 }
552 {
553 let mut traits = ::facet_core::MarkerTraits::empty();
554 if {
555 /// Fallback trait with `False` for `IMPLS` if the type does not
556 /// implement the given trait.
557 trait DoesNotImpl {
558 const IMPLS: bool = false;
559 }
560 impl<T: ?Sized> DoesNotImpl for T {}
561 /// Concrete type with `True` for `IMPLS` if the type implements the
562 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
563 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
564 #[allow(dead_code)]
565 impl<T: ?Sized + core::cmp::Eq> Wrapper<T> {
566 const IMPLS: bool = true;
567 }
568 <Wrapper<Self>>::IMPLS
569 } {
570 traits = traits.union(::facet_core::MarkerTraits::EQ);
571 }
572 if {
573 /// Fallback trait with `False` for `IMPLS` if the type does not
574 /// implement the given trait.
575 trait DoesNotImpl {
576 const IMPLS: bool = false;
577 }
578 impl<T: ?Sized> DoesNotImpl for T {}
579 /// Concrete type with `True` for `IMPLS` if the type implements the
580 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
581 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
582 #[allow(dead_code)]
583 impl<T: ?Sized + core::marker::Send> Wrapper<T> {
584 const IMPLS: bool = true;
585 }
586 <Wrapper<Self>>::IMPLS
587 } {
588 traits = traits.union(::facet_core::MarkerTraits::SEND);
589 }
590 if {
591 /// Fallback trait with `False` for `IMPLS` if the type does not
592 /// implement the given trait.
593 trait DoesNotImpl {
594 const IMPLS: bool = false;
595 }
596 impl<T: ?Sized> DoesNotImpl for T {}
597 /// Concrete type with `True` for `IMPLS` if the type implements the
598 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
599 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
600 #[allow(dead_code)]
601 impl<T: ?Sized + core::marker::Sync> Wrapper<T> {
602 const IMPLS: bool = true;
603 }
604 <Wrapper<Self>>::IMPLS
605 } {
606 traits = traits.union(::facet_core::MarkerTraits::SYNC);
607 }
608 if {
609 /// Fallback trait with `False` for `IMPLS` if the type does not
610 /// implement the given trait.
611 trait DoesNotImpl {
612 const IMPLS: bool = false;
613 }
614 impl<T: ?Sized> DoesNotImpl for T {}
615 /// Concrete type with `True` for `IMPLS` if the type implements the
616 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
617 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
618 #[allow(dead_code)]
619 impl<T: ?Sized + core::marker::Copy> Wrapper<T> {
620 const IMPLS: bool = true;
621 }
622 <Wrapper<Self>>::IMPLS
623 } {
624 traits = traits.union(::facet_core::MarkerTraits::COPY);
625 }
626 if {
627 /// Fallback trait with `False` for `IMPLS` if the type does not
628 /// implement the given trait.
629 trait DoesNotImpl {
630 const IMPLS: bool = false;
631 }
632 impl<T: ?Sized> DoesNotImpl for T {}
633 /// Concrete type with `True` for `IMPLS` if the type implements the
634 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
635 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
636 #[allow(dead_code)]
637 impl<T: ?Sized + core::marker::Unpin> Wrapper<T> {
638 const IMPLS: bool = true;
639 }
640 <Wrapper<Self>>::IMPLS
641 } {
642 traits = traits.union(::facet_core::MarkerTraits::UNPIN);
643 }
644 builder = builder.marker_traits(traits);
645 }
646 if {
647 /// Fallback trait with `False` for `IMPLS` if the type does not
648 /// implement the given trait.
649 trait DoesNotImpl {
650 const IMPLS: bool = false;
651 }
652 impl<T: ?Sized> DoesNotImpl for T {}
653 /// Concrete type with `True` for `IMPLS` if the type implements the
654 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
655 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
656 #[allow(dead_code)]
657 impl<T: ?Sized + core::cmp::PartialEq> Wrapper<T> {
658 const IMPLS: bool = true;
659 }
660 <Wrapper<Self>>::IMPLS
661 } {
662 builder = builder.eq(|left, right| {
663 use ::facet_core::spez::*;
664 (&&Spez(unsafe { left.get::<Self>() }))
665 .spez_eq(&&Spez(unsafe { right.get::<Self>() }))
666 });
667 }
668 if {
669 /// Fallback trait with `False` for `IMPLS` if the type does not
670 /// implement the given trait.
671 trait DoesNotImpl {
672 const IMPLS: bool = false;
673 }
674 impl<T: ?Sized> DoesNotImpl for T {}
675 /// Concrete type with `True` for `IMPLS` if the type implements the
676 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
677 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
678 #[allow(dead_code)]
679 impl<T: ?Sized + core::cmp::PartialOrd> Wrapper<T> {
680 const IMPLS: bool = true;
681 }
682 <Wrapper<Self>>::IMPLS
683 } {
684 builder = builder.partial_ord(|left, right| {
685 use ::facet_core::spez::*;
686 (&&Spez(unsafe { left.get::<Self>() }))
687 .spez_partial_cmp(&&Spez(unsafe { right.get::<Self>() }))
688 });
689 }
690 if {
691 /// Fallback trait with `False` for `IMPLS` if the type does not
692 /// implement the given trait.
693 trait DoesNotImpl {
694 const IMPLS: bool = false;
695 }
696 impl<T: ?Sized> DoesNotImpl for T {}
697 /// Concrete type with `True` for `IMPLS` if the type implements the
698 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
699 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
700 #[allow(dead_code)]
701 impl<T: ?Sized + core::cmp::Ord> Wrapper<T> {
702 const IMPLS: bool = true;
703 }
704 <Wrapper<Self>>::IMPLS
705 } {
706 builder = builder.ord(|left, right| {
707 use ::facet_core::spez::*;
708 (&&Spez(unsafe { left.get::<Self>() }))
709 .spez_cmp(&&Spez(unsafe { right.get::<Self>() }))
710 });
711 }
712 if {
713 /// Fallback trait with `False` for `IMPLS` if the type does not
714 /// implement the given trait.
715 trait DoesNotImpl {
716 const IMPLS: bool = false;
717 }
718 impl<T: ?Sized> DoesNotImpl for T {}
719 /// Concrete type with `True` for `IMPLS` if the type implements the
720 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
721 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
722 #[allow(dead_code)]
723 impl<T: ?Sized + core::hash::Hash> Wrapper<T> {
724 const IMPLS: bool = true;
725 }
726 <Wrapper<Self>>::IMPLS
727 } {
728 builder = builder.hash(|value, hasher_this, hasher_write_fn| {
729 use ::facet_core::HasherProxy;
730 use ::facet_core::spez::*;
731 (&&Spez(unsafe { value.get::<Self>() })).spez_hash(&mut unsafe {
732 HasherProxy::new(hasher_this, hasher_write_fn)
733 })
734 });
735 }
736 if {
737 /// Fallback trait with `False` for `IMPLS` if the type does not
738 /// implement the given trait.
739 trait DoesNotImpl {
740 const IMPLS: bool = false;
741 }
742 impl<T: ?Sized> DoesNotImpl for T {}
743 /// Concrete type with `True` for `IMPLS` if the type implements the
744 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
745 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
746 #[allow(dead_code)]
747 impl<T: ?Sized + core::str::FromStr> Wrapper<T> {
748 const IMPLS: bool = true;
749 }
750 <Wrapper<Self>>::IMPLS
751 } {
752 builder = builder.parse(|s, target| {
753 use ::facet_core::spez::*;
754 let res = unsafe { (&&SpezEmpty::<Self>::SPEZ).spez_parse(s, target) };
755 res.map(|_| unsafe { target.assume_init() })
756 });
757 }
758 builder.build()
759 };
760 vtable
761 };
762 crate::Shape::builder()
763 .id(crate::ConstTypeId::of::<Self>())
764 .layout(::core::alloc::Layout::new::<Self>())
765 .vtable(vtable)
766 .def(crate::Def::Struct(
767 crate::Struct::builder()
768 .kind(crate::StructKind::Struct)
769 .fields(fields)
770 .build(),
771 ))
772 .doc(&[" A simple point struct, also deriving Facet."])
773 .build()
774 };
775}
776/// An enum demonstrating different variant types and attributes.
777#[repr(u8)]
778pub enum KitchenSinkEnum {
779 /// A simple unit variant.
780 UnitVariant,
781
782 /// A tuple variant with a single element.
783 ///
784 /// The contained `String` represents an important message payload.
785 TupleVariantSimple(String),
786
787 /// A tuple variant with multiple elements.
788 ///
789 /// Contains important positional data:
790 /// - `_0` (i32): An identifier code.
791 /// - `_1` (i32): A sequence number.
792 /// - `_2` (i32): A status flag.
793 TupleVariantMulti(i32, i32, i32),
794
795 /// A struct variant with named fields.
796 StructVariant {
797 /// The width dimension, crucial for rendering.
798 width: f64,
799 /// The height dimension, also crucial for rendering.
800 height: f64,
801 },
802
803 /// A tuple variant marked entirely as sensitive.
804 SensitiveTupleVariant(Vec<u8>),
805
806 /// A struct variant containing a sensitive field.
807 StructVariantWithSensitiveField {
808 /// The main data payload, publicly accessible.
809 payload: Vec<u8>,
810 /// The sensitive checksum for integrity verification.
811 checksum: u32,
812 },
813
814 /// A variant marked as arbitrary, potentially skipped during processing.
815 ArbitraryVariant((f64, f64)),
816
817 /// A variant containing another enum that derives Facet.
818 ///
819 /// The nested `SubEnum` indicates a specific sub-state or option.
820 NestedEnumVariant(SubEnum),
821}
822#[used]
823static KITCHEN_SINK_ENUM_SHAPE: &'static crate::Shape = <KitchenSinkEnum as crate::Facet>::SHAPE;
824#[automatically_derived]
825unsafe impl<'__facet> crate::Facet<'__facet> for KitchenSinkEnum {
826 const SHAPE: &'static crate::Shape = &const {
827 #[repr(C)]
828 struct __ShadowKitchenSinkEnum_TupleVariantSimple<'__facet> {
829 _discriminant: u8,
830 _phantom: ::core::marker::PhantomData<(*mut &'__facet ())>,
831 _0: String,
832 }
833 #[repr(C)]
834 struct __ShadowKitchenSinkEnum_TupleVariantMulti<'__facet> {
835 _discriminant: u8,
836 _phantom: ::core::marker::PhantomData<(*mut &'__facet ())>,
837 _0: i32,
838 _1: i32,
839 _2: i32,
840 }
841 #[repr(C)]
842 struct __ShadowKitchenSinkEnum_StructVariant<'__facet> {
843 _discriminant: u8,
844 _phantom: ::core::marker::PhantomData<(*mut &'__facet ())>,
845 width: f64,
846 height: f64,
847 }
848 #[repr(C)]
849 struct __ShadowKitchenSinkEnum_SensitiveTupleVariant<'__facet> {
850 _discriminant: u8,
851 _phantom: ::core::marker::PhantomData<(*mut &'__facet ())>,
852 _0: Vec<u8>,
853 }
854 #[repr(C)]
855 struct __ShadowKitchenSinkEnum_StructVariantWithSensitiveField<'__facet> {
856 _discriminant: u8,
857 _phantom: ::core::marker::PhantomData<(*mut &'__facet ())>,
858 payload: Vec<u8>,
859 checksum: u32,
860 }
861 #[repr(C)]
862 struct __ShadowKitchenSinkEnum_ArbitraryVariant<'__facet> {
863 _discriminant: u8,
864 _phantom: ::core::marker::PhantomData<(*mut &'__facet ())>,
865 _0: (f64, f64),
866 }
867 #[repr(C)]
868 struct __ShadowKitchenSinkEnum_NestedEnumVariant<'__facet> {
869 _discriminant: u8,
870 _phantom: ::core::marker::PhantomData<(*mut &'__facet ())>,
871 _0: SubEnum,
872 }
873 let __facet_variants: &'static [crate::Variant] = &const {
874 [
875 crate::Variant::builder()
876 .name("UnitVariant")
877 .discriminant(0)
878 .fields(crate::Struct::builder().unit().build())
879 .doc(&[" A simple unit variant."])
880 .build(),
881 {
882 let fields: &'static [crate::Field] = &const {
883 [crate::Field::builder().name("_0").shape(||
884 crate::shape_of(&(|s:
885 &__ShadowKitchenSinkEnum_TupleVariantSimple<'__facet>|
886 &s._0))).offset({
887 builtin # offset_of(__ShadowKitchenSinkEnum_TupleVariantSimple<'__facet>,
888 _0)
889 }).flags(crate::FieldFlags::EMPTY).attributes(&const {
890 []
891 }).build()]
892 };
893 crate::Variant::builder()
894 .name("TupleVariantSimple")
895 .discriminant(1)
896 .fields(crate::Struct::builder().tuple().fields(fields).build())
897 .doc(&[
898 " A tuple variant with a single element.",
899 "",
900 " The contained `String` represents an important message payload.",
901 ])
902 .build()
903 },
904 {
905 let fields: &'static [crate::Field] = &const {
906 [crate::Field::builder().name("_0").shape(||
907 crate::shape_of(&(|s:
908 &__ShadowKitchenSinkEnum_TupleVariantMulti<'__facet>|
909 &s._0))).offset({
910 builtin # offset_of(__ShadowKitchenSinkEnum_TupleVariantMulti<'__facet>,
911 _0)
912 }).flags(crate::FieldFlags::EMPTY).attributes(&const {
913 []
914 }).build(),
915 crate::Field::builder().name("_1").shape(||
916 crate::shape_of(&(|s:
917 &__ShadowKitchenSinkEnum_TupleVariantMulti<'__facet>|
918 &s._1))).offset({
919 builtin # offset_of(__ShadowKitchenSinkEnum_TupleVariantMulti<'__facet>,
920 _1)
921 }).flags(crate::FieldFlags::EMPTY).attributes(&const {
922 []
923 }).build(),
924 crate::Field::builder().name("_2").shape(||
925 crate::shape_of(&(|s:
926 &__ShadowKitchenSinkEnum_TupleVariantMulti<'__facet>|
927 &s._2))).offset({
928 builtin # offset_of(__ShadowKitchenSinkEnum_TupleVariantMulti<'__facet>,
929 _2)
930 }).flags(crate::FieldFlags::EMPTY).attributes(&const {
931 []
932 }).build()]
933 };
934 crate::Variant::builder()
935 .name("TupleVariantMulti")
936 .discriminant(2)
937 .fields(crate::Struct::builder().tuple().fields(fields).build())
938 .doc(&[
939 " A tuple variant with multiple elements.",
940 "",
941 " Contains important positional data:",
942 " - `_0` (i32): An identifier code.",
943 " - `_1` (i32): A sequence number.",
944 " - `_2` (i32): A status flag.",
945 ])
946 .build()
947 },
948 {
949 let fields: &'static [crate::Field] = &const {
950 [crate::Field::builder().name("width").shape(||
951 crate::shape_of(&(|s:
952 &__ShadowKitchenSinkEnum_StructVariant<'__facet>|
953 &s.width))).offset({
954 builtin # offset_of(__ShadowKitchenSinkEnum_StructVariant<'__facet>,
955 width)
956 }).flags(crate::FieldFlags::EMPTY).attributes(&const {
957 []
958 }).doc(&[" The width dimension, crucial for rendering."]).build(),
959 crate::Field::builder().name("height").shape(||
960 crate::shape_of(&(|s:
961 &__ShadowKitchenSinkEnum_StructVariant<'__facet>|
962 &s.height))).offset({
963 builtin # offset_of(__ShadowKitchenSinkEnum_StructVariant<'__facet>,
964 height)
965 }).flags(crate::FieldFlags::EMPTY).attributes(&const {
966 []
967 }).doc(&[" The height dimension, also crucial for rendering."]).build()]
968 };
969 crate::Variant::builder()
970 .name("StructVariant")
971 .discriminant(3)
972 .fields(crate::Struct::builder().struct_().fields(fields).build())
973 .doc(&[" A struct variant with named fields."])
974 .build()
975 },
976 {
977 let fields: &'static [crate::Field] = &const {
978 [crate::Field::builder().name("_0").shape(||
979 crate::shape_of(&(|s:
980 &__ShadowKitchenSinkEnum_SensitiveTupleVariant<'__facet>|
981 &s._0))).offset({
982 builtin # offset_of(__ShadowKitchenSinkEnum_SensitiveTupleVariant<'__facet>,
983 _0)
984 }).flags(crate::FieldFlags::EMPTY).attributes(&const {
985 []
986 }).build()]
987 };
988 crate::Variant::builder()
989 .name("SensitiveTupleVariant")
990 .discriminant(4)
991 .fields(crate::Struct::builder().tuple().fields(fields).build())
992 .doc(&[" A tuple variant marked entirely as sensitive."])
993 .build()
994 },
995 {
996 let fields: &'static [crate::Field] = &const {
997 [crate::Field::builder().name("payload").shape(||
998 crate::shape_of(&(|s:
999 &__ShadowKitchenSinkEnum_StructVariantWithSensitiveField<'__facet>|
1000 &s.payload))).offset({
1001 builtin # offset_of(__ShadowKitchenSinkEnum_StructVariantWithSensitiveField<'__facet>,
1002 payload)
1003 }).flags(crate::FieldFlags::EMPTY).attributes(&const {
1004 []
1005 }).doc(&[" The main data payload, publicly accessible."]).build(),
1006 crate::Field::builder().name("checksum").shape(||
1007 crate::shape_of(&(|s:
1008 &__ShadowKitchenSinkEnum_StructVariantWithSensitiveField<'__facet>|
1009 &s.checksum))).offset({
1010 builtin # offset_of(__ShadowKitchenSinkEnum_StructVariantWithSensitiveField<'__facet>,
1011 checksum)
1012 }).flags(crate::FieldFlags::SENSITIVE).attributes(&const {
1013 [crate::FieldAttribute::Sensitive]
1014 }).doc(&[" The sensitive checksum for integrity verification."]).build()]
1015 };
1016 crate::Variant::builder()
1017 .name("StructVariantWithSensitiveField")
1018 .discriminant(5)
1019 .fields(crate::Struct::builder().struct_().fields(fields).build())
1020 .doc(&[" A struct variant containing a sensitive field."])
1021 .build()
1022 },
1023 {
1024 let fields: &'static [crate::Field] = &const {
1025 [crate::Field::builder().name("_0").shape(||
1026 crate::shape_of(&(|s:
1027 &__ShadowKitchenSinkEnum_ArbitraryVariant<'__facet>|
1028 &s._0))).offset({
1029 builtin # offset_of(__ShadowKitchenSinkEnum_ArbitraryVariant<'__facet>,
1030 _0)
1031 }).flags(crate::FieldFlags::EMPTY).attributes(&const {
1032 []
1033 }).build()]
1034 };
1035 crate::Variant::builder().name("ArbitraryVariant").discriminant(6).fields(crate::Struct::builder().tuple().fields(fields).build()).doc(&[" A variant marked as arbitrary, potentially skipped during processing."]).build()
1036 },
1037 {
1038 let fields: &'static [crate::Field] = &const {
1039 [crate::Field::builder().name("_0").shape(||
1040 crate::shape_of(&(|s:
1041 &__ShadowKitchenSinkEnum_NestedEnumVariant<'__facet>|
1042 &s._0))).offset({
1043 builtin # offset_of(__ShadowKitchenSinkEnum_NestedEnumVariant<'__facet>,
1044 _0)
1045 }).flags(crate::FieldFlags::EMPTY).attributes(&const {
1046 []
1047 }).build()]
1048 };
1049 crate::Variant::builder()
1050 .name("NestedEnumVariant")
1051 .discriminant(7)
1052 .fields(crate::Struct::builder().tuple().fields(fields).build())
1053 .doc(&[
1054 " A variant containing another enum that derives Facet.",
1055 "",
1056 " The nested `SubEnum` indicates a specific sub-state or option.",
1057 ])
1058 .build()
1059 },
1060 ]
1061 };
1062 crate::Shape::builder()
1063 .id(crate::ConstTypeId::of::<Self>())
1064 .layout(::core::alloc::Layout::new::<Self>())
1065 .vtable(
1066 &const {
1067 let mut builder = ::facet_core::ValueVTable::builder()
1068 .type_name(|f, _opts| ::core::fmt::Write::write_str(f, "KitchenSinkEnum"))
1069 .drop_in_place(|data| unsafe { data.drop_in_place::<Self>() });
1070 if {
1071 /// Fallback trait with `False` for `IMPLS` if the type does not
1072 /// implement the given trait.
1073 trait DoesNotImpl {
1074 const IMPLS: bool = false;
1075 }
1076 impl<T: ?Sized> DoesNotImpl for T {}
1077 /// Concrete type with `True` for `IMPLS` if the type implements the
1078 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1079 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1080 #[allow(dead_code)]
1081 impl<T: ?Sized + core::fmt::Display> Wrapper<T> {
1082 const IMPLS: bool = true;
1083 }
1084 <Wrapper<Self>>::IMPLS
1085 } {
1086 builder = builder.display(|data, f| {
1087 use ::facet_core::spez::*;
1088 (&&Spez(unsafe { data.get::<Self>() })).spez_display(f)
1089 });
1090 }
1091 if {
1092 /// Fallback trait with `False` for `IMPLS` if the type does not
1093 /// implement the given trait.
1094 trait DoesNotImpl {
1095 const IMPLS: bool = false;
1096 }
1097 impl<T: ?Sized> DoesNotImpl for T {}
1098 /// Concrete type with `True` for `IMPLS` if the type implements the
1099 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1100 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1101 #[allow(dead_code)]
1102 impl<T: ?Sized + core::fmt::Debug> Wrapper<T> {
1103 const IMPLS: bool = true;
1104 }
1105 <Wrapper<Self>>::IMPLS
1106 } {
1107 builder = builder.debug(|data, f| {
1108 use ::facet_core::spez::*;
1109 (&&Spez(unsafe { data.get::<Self>() })).spez_debug(f)
1110 });
1111 }
1112 if {
1113 /// Fallback trait with `False` for `IMPLS` if the type does not
1114 /// implement the given trait.
1115 trait DoesNotImpl {
1116 const IMPLS: bool = false;
1117 }
1118 impl<T: ?Sized> DoesNotImpl for T {}
1119 /// Concrete type with `True` for `IMPLS` if the type implements the
1120 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1121 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1122 #[allow(dead_code)]
1123 impl<T: ?Sized + core::default::Default> Wrapper<T> {
1124 const IMPLS: bool = true;
1125 }
1126 <Wrapper<Self>>::IMPLS
1127 } {
1128 builder = builder.default_in_place(|target| {
1129 use ::facet_core::spez::*;
1130 unsafe { (&&SpezEmpty::<Self>::SPEZ).spez_default_in_place(target) }
1131 });
1132 }
1133 if {
1134 /// Fallback trait with `False` for `IMPLS` if the type does not
1135 /// implement the given trait.
1136 trait DoesNotImpl {
1137 const IMPLS: bool = false;
1138 }
1139 impl<T: ?Sized> DoesNotImpl for T {}
1140 /// Concrete type with `True` for `IMPLS` if the type implements the
1141 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1142 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1143 #[allow(dead_code)]
1144 impl<T: ?Sized + core::clone::Clone> Wrapper<T> {
1145 const IMPLS: bool = true;
1146 }
1147 <Wrapper<Self>>::IMPLS
1148 } {
1149 builder = builder.clone_into(|src, dst| {
1150 use ::facet_core::spez::*;
1151 unsafe { (&&Spez(src.get::<Self>())).spez_clone_into(dst) }
1152 });
1153 }
1154 {
1155 let mut traits = ::facet_core::MarkerTraits::empty();
1156 if {
1157 /// Fallback trait with `False` for `IMPLS` if the type does not
1158 /// implement the given trait.
1159 trait DoesNotImpl {
1160 const IMPLS: bool = false;
1161 }
1162 impl<T: ?Sized> DoesNotImpl for T {}
1163 /// Concrete type with `True` for `IMPLS` if the type implements the
1164 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1165 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1166 #[allow(dead_code)]
1167 impl<T: ?Sized + core::cmp::Eq> Wrapper<T> {
1168 const IMPLS: bool = true;
1169 }
1170 <Wrapper<Self>>::IMPLS
1171 } {
1172 traits = traits.union(::facet_core::MarkerTraits::EQ);
1173 }
1174 if {
1175 /// Fallback trait with `False` for `IMPLS` if the type does not
1176 /// implement the given trait.
1177 trait DoesNotImpl {
1178 const IMPLS: bool = false;
1179 }
1180 impl<T: ?Sized> DoesNotImpl for T {}
1181 /// Concrete type with `True` for `IMPLS` if the type implements the
1182 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1183 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1184 #[allow(dead_code)]
1185 impl<T: ?Sized + core::marker::Send> Wrapper<T> {
1186 const IMPLS: bool = true;
1187 }
1188 <Wrapper<Self>>::IMPLS
1189 } {
1190 traits = traits.union(::facet_core::MarkerTraits::SEND);
1191 }
1192 if {
1193 /// Fallback trait with `False` for `IMPLS` if the type does not
1194 /// implement the given trait.
1195 trait DoesNotImpl {
1196 const IMPLS: bool = false;
1197 }
1198 impl<T: ?Sized> DoesNotImpl for T {}
1199 /// Concrete type with `True` for `IMPLS` if the type implements the
1200 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1201 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1202 #[allow(dead_code)]
1203 impl<T: ?Sized + core::marker::Sync> Wrapper<T> {
1204 const IMPLS: bool = true;
1205 }
1206 <Wrapper<Self>>::IMPLS
1207 } {
1208 traits = traits.union(::facet_core::MarkerTraits::SYNC);
1209 }
1210 if {
1211 /// Fallback trait with `False` for `IMPLS` if the type does not
1212 /// implement the given trait.
1213 trait DoesNotImpl {
1214 const IMPLS: bool = false;
1215 }
1216 impl<T: ?Sized> DoesNotImpl for T {}
1217 /// Concrete type with `True` for `IMPLS` if the type implements the
1218 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1219 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1220 #[allow(dead_code)]
1221 impl<T: ?Sized + core::marker::Copy> Wrapper<T> {
1222 const IMPLS: bool = true;
1223 }
1224 <Wrapper<Self>>::IMPLS
1225 } {
1226 traits = traits.union(::facet_core::MarkerTraits::COPY);
1227 }
1228 if {
1229 /// Fallback trait with `False` for `IMPLS` if the type does not
1230 /// implement the given trait.
1231 trait DoesNotImpl {
1232 const IMPLS: bool = false;
1233 }
1234 impl<T: ?Sized> DoesNotImpl for T {}
1235 /// Concrete type with `True` for `IMPLS` if the type implements the
1236 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1237 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1238 #[allow(dead_code)]
1239 impl<T: ?Sized + core::marker::Unpin> Wrapper<T> {
1240 const IMPLS: bool = true;
1241 }
1242 <Wrapper<Self>>::IMPLS
1243 } {
1244 traits = traits.union(::facet_core::MarkerTraits::UNPIN);
1245 }
1246 builder = builder.marker_traits(traits);
1247 }
1248 if {
1249 /// Fallback trait with `False` for `IMPLS` if the type does not
1250 /// implement the given trait.
1251 trait DoesNotImpl {
1252 const IMPLS: bool = false;
1253 }
1254 impl<T: ?Sized> DoesNotImpl for T {}
1255 /// Concrete type with `True` for `IMPLS` if the type implements the
1256 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1257 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1258 #[allow(dead_code)]
1259 impl<T: ?Sized + core::cmp::PartialEq> Wrapper<T> {
1260 const IMPLS: bool = true;
1261 }
1262 <Wrapper<Self>>::IMPLS
1263 } {
1264 builder = builder.eq(|left, right| {
1265 use ::facet_core::spez::*;
1266 (&&Spez(unsafe { left.get::<Self>() }))
1267 .spez_eq(&&Spez(unsafe { right.get::<Self>() }))
1268 });
1269 }
1270 if {
1271 /// Fallback trait with `False` for `IMPLS` if the type does not
1272 /// implement the given trait.
1273 trait DoesNotImpl {
1274 const IMPLS: bool = false;
1275 }
1276 impl<T: ?Sized> DoesNotImpl for T {}
1277 /// Concrete type with `True` for `IMPLS` if the type implements the
1278 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1279 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1280 #[allow(dead_code)]
1281 impl<T: ?Sized + core::cmp::PartialOrd> Wrapper<T> {
1282 const IMPLS: bool = true;
1283 }
1284 <Wrapper<Self>>::IMPLS
1285 } {
1286 builder = builder.partial_ord(|left, right| {
1287 use ::facet_core::spez::*;
1288 (&&Spez(unsafe { left.get::<Self>() }))
1289 .spez_partial_cmp(&&Spez(unsafe { right.get::<Self>() }))
1290 });
1291 }
1292 if {
1293 /// Fallback trait with `False` for `IMPLS` if the type does not
1294 /// implement the given trait.
1295 trait DoesNotImpl {
1296 const IMPLS: bool = false;
1297 }
1298 impl<T: ?Sized> DoesNotImpl for T {}
1299 /// Concrete type with `True` for `IMPLS` if the type implements the
1300 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1301 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1302 #[allow(dead_code)]
1303 impl<T: ?Sized + core::cmp::Ord> Wrapper<T> {
1304 const IMPLS: bool = true;
1305 }
1306 <Wrapper<Self>>::IMPLS
1307 } {
1308 builder = builder.ord(|left, right| {
1309 use ::facet_core::spez::*;
1310 (&&Spez(unsafe { left.get::<Self>() }))
1311 .spez_cmp(&&Spez(unsafe { right.get::<Self>() }))
1312 });
1313 }
1314 if {
1315 /// Fallback trait with `False` for `IMPLS` if the type does not
1316 /// implement the given trait.
1317 trait DoesNotImpl {
1318 const IMPLS: bool = false;
1319 }
1320 impl<T: ?Sized> DoesNotImpl for T {}
1321 /// Concrete type with `True` for `IMPLS` if the type implements the
1322 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1323 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1324 #[allow(dead_code)]
1325 impl<T: ?Sized + core::hash::Hash> Wrapper<T> {
1326 const IMPLS: bool = true;
1327 }
1328 <Wrapper<Self>>::IMPLS
1329 } {
1330 builder = builder.hash(|value, hasher_this, hasher_write_fn| {
1331 use ::facet_core::HasherProxy;
1332 use ::facet_core::spez::*;
1333 (&&Spez(unsafe { value.get::<Self>() })).spez_hash(&mut unsafe {
1334 HasherProxy::new(hasher_this, hasher_write_fn)
1335 })
1336 });
1337 }
1338 if {
1339 /// Fallback trait with `False` for `IMPLS` if the type does not
1340 /// implement the given trait.
1341 trait DoesNotImpl {
1342 const IMPLS: bool = false;
1343 }
1344 impl<T: ?Sized> DoesNotImpl for T {}
1345 /// Concrete type with `True` for `IMPLS` if the type implements the
1346 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1347 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1348 #[allow(dead_code)]
1349 impl<T: ?Sized + core::str::FromStr> Wrapper<T> {
1350 const IMPLS: bool = true;
1351 }
1352 <Wrapper<Self>>::IMPLS
1353 } {
1354 builder = builder.parse(|s, target| {
1355 use ::facet_core::spez::*;
1356 let res = unsafe { (&&SpezEmpty::<Self>::SPEZ).spez_parse(s, target) };
1357 res.map(|_| unsafe { target.assume_init() })
1358 });
1359 }
1360 builder.build()
1361 },
1362 )
1363 .def(crate::Def::Enum(
1364 crate::EnumDef::builder()
1365 .variants(__facet_variants)
1366 .repr(crate::EnumRepr::U8)
1367 .build(),
1368 ))
1369 .doc(&[" An enum demonstrating different variant types and attributes."])
1370 .build()
1371 };
1372}
1373/// A sub-enum used within `KitchenSinkEnum`.
1374#[repr(u8)]
1375pub enum SubEnum {
1376 /// Option A.
1377 OptionA,
1378
1379 /// Option B with data.
1380 OptionB(u8),
1381
1382 /// A sensitive option.
1383 SensitiveOption(u64),
1384
1385 /// An arbitrary option.
1386 ArbitraryOption(u8),
1387}
1388#[used]
1389static SUB_ENUM_SHAPE: &'static crate::Shape = <SubEnum as crate::Facet>::SHAPE;
1390#[automatically_derived]
1391unsafe impl<'__facet> crate::Facet<'__facet> for SubEnum {
1392 const SHAPE: &'static crate::Shape = &const {
1393 #[repr(C)]
1394 struct __ShadowSubEnum_OptionB<'__facet> {
1395 _discriminant: u8,
1396 _phantom: ::core::marker::PhantomData<(*mut &'__facet ())>,
1397 _0: u8,
1398 }
1399 #[repr(C)]
1400 struct __ShadowSubEnum_SensitiveOption<'__facet> {
1401 _discriminant: u8,
1402 _phantom: ::core::marker::PhantomData<(*mut &'__facet ())>,
1403 _0: u64,
1404 }
1405 #[repr(C)]
1406 struct __ShadowSubEnum_ArbitraryOption<'__facet> {
1407 _discriminant: u8,
1408 _phantom: ::core::marker::PhantomData<(*mut &'__facet ())>,
1409 _0: u8,
1410 }
1411 let __facet_variants: &'static [crate::Variant] = &const {
1412 [
1413 crate::Variant::builder()
1414 .name("OptionA")
1415 .discriminant(0)
1416 .fields(crate::Struct::builder().unit().build())
1417 .doc(&[" Option A."])
1418 .build(),
1419 {
1420 let fields: &'static [crate::Field] = &const {
1421 [crate::Field::builder()
1422 .name("_0")
1423 .shape(|| {
1424 crate::shape_of(&(|s: &__ShadowSubEnum_OptionB<'__facet>| &s._0))
1425 })
1426 .offset({
1427 builtin # offset_of(__ShadowSubEnum_OptionB<'__facet>, _0)
1428 })
1429 .flags(crate::FieldFlags::EMPTY)
1430 .attributes(&const { [] })
1431 .build()]
1432 };
1433 crate::Variant::builder()
1434 .name("OptionB")
1435 .discriminant(1)
1436 .fields(crate::Struct::builder().tuple().fields(fields).build())
1437 .doc(&[" Option B with data."])
1438 .build()
1439 },
1440 {
1441 let fields: &'static [crate::Field] = &const {
1442 [crate::Field::builder()
1443 .name("_0")
1444 .shape(|| {
1445 crate::shape_of(
1446 &(|s: &__ShadowSubEnum_SensitiveOption<'__facet>| &s._0),
1447 )
1448 })
1449 .offset({
1450 builtin # offset_of(__ShadowSubEnum_SensitiveOption<'__facet>,
1451 _0)
1452 })
1453 .flags(crate::FieldFlags::EMPTY)
1454 .attributes(&const { [] })
1455 .build()]
1456 };
1457 crate::Variant::builder()
1458 .name("SensitiveOption")
1459 .discriminant(2)
1460 .fields(crate::Struct::builder().tuple().fields(fields).build())
1461 .doc(&[" A sensitive option."])
1462 .build()
1463 },
1464 {
1465 let fields: &'static [crate::Field] = &const {
1466 [crate::Field::builder()
1467 .name("_0")
1468 .shape(|| {
1469 crate::shape_of(
1470 &(|s: &__ShadowSubEnum_ArbitraryOption<'__facet>| &s._0),
1471 )
1472 })
1473 .offset({
1474 builtin # offset_of(__ShadowSubEnum_ArbitraryOption<'__facet>,
1475 _0)
1476 })
1477 .flags(crate::FieldFlags::EMPTY)
1478 .attributes(&const { [] })
1479 .build()]
1480 };
1481 crate::Variant::builder()
1482 .name("ArbitraryOption")
1483 .discriminant(3)
1484 .fields(crate::Struct::builder().tuple().fields(fields).build())
1485 .doc(&[" An arbitrary option."])
1486 .build()
1487 },
1488 ]
1489 };
1490 crate::Shape::builder()
1491 .id(crate::ConstTypeId::of::<Self>())
1492 .layout(::core::alloc::Layout::new::<Self>())
1493 .vtable(
1494 &const {
1495 let mut builder = ::facet_core::ValueVTable::builder()
1496 .type_name(|f, _opts| ::core::fmt::Write::write_str(f, "SubEnum"))
1497 .drop_in_place(|data| unsafe { data.drop_in_place::<Self>() });
1498 if {
1499 /// Fallback trait with `False` for `IMPLS` if the type does not
1500 /// implement the given trait.
1501 trait DoesNotImpl {
1502 const IMPLS: bool = false;
1503 }
1504 impl<T: ?Sized> DoesNotImpl for T {}
1505 /// Concrete type with `True` for `IMPLS` if the type implements the
1506 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1507 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1508 #[allow(dead_code)]
1509 impl<T: ?Sized + core::fmt::Display> Wrapper<T> {
1510 const IMPLS: bool = true;
1511 }
1512 <Wrapper<Self>>::IMPLS
1513 } {
1514 builder = builder.display(|data, f| {
1515 use ::facet_core::spez::*;
1516 (&&Spez(unsafe { data.get::<Self>() })).spez_display(f)
1517 });
1518 }
1519 if {
1520 /// Fallback trait with `False` for `IMPLS` if the type does not
1521 /// implement the given trait.
1522 trait DoesNotImpl {
1523 const IMPLS: bool = false;
1524 }
1525 impl<T: ?Sized> DoesNotImpl for T {}
1526 /// Concrete type with `True` for `IMPLS` if the type implements the
1527 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1528 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1529 #[allow(dead_code)]
1530 impl<T: ?Sized + core::fmt::Debug> Wrapper<T> {
1531 const IMPLS: bool = true;
1532 }
1533 <Wrapper<Self>>::IMPLS
1534 } {
1535 builder = builder.debug(|data, f| {
1536 use ::facet_core::spez::*;
1537 (&&Spez(unsafe { data.get::<Self>() })).spez_debug(f)
1538 });
1539 }
1540 if {
1541 /// Fallback trait with `False` for `IMPLS` if the type does not
1542 /// implement the given trait.
1543 trait DoesNotImpl {
1544 const IMPLS: bool = false;
1545 }
1546 impl<T: ?Sized> DoesNotImpl for T {}
1547 /// Concrete type with `True` for `IMPLS` if the type implements the
1548 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1549 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1550 #[allow(dead_code)]
1551 impl<T: ?Sized + core::default::Default> Wrapper<T> {
1552 const IMPLS: bool = true;
1553 }
1554 <Wrapper<Self>>::IMPLS
1555 } {
1556 builder = builder.default_in_place(|target| {
1557 use ::facet_core::spez::*;
1558 unsafe { (&&SpezEmpty::<Self>::SPEZ).spez_default_in_place(target) }
1559 });
1560 }
1561 if {
1562 /// Fallback trait with `False` for `IMPLS` if the type does not
1563 /// implement the given trait.
1564 trait DoesNotImpl {
1565 const IMPLS: bool = false;
1566 }
1567 impl<T: ?Sized> DoesNotImpl for T {}
1568 /// Concrete type with `True` for `IMPLS` if the type implements the
1569 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1570 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1571 #[allow(dead_code)]
1572 impl<T: ?Sized + core::clone::Clone> Wrapper<T> {
1573 const IMPLS: bool = true;
1574 }
1575 <Wrapper<Self>>::IMPLS
1576 } {
1577 builder = builder.clone_into(|src, dst| {
1578 use ::facet_core::spez::*;
1579 unsafe { (&&Spez(src.get::<Self>())).spez_clone_into(dst) }
1580 });
1581 }
1582 {
1583 let mut traits = ::facet_core::MarkerTraits::empty();
1584 if {
1585 /// Fallback trait with `False` for `IMPLS` if the type does not
1586 /// implement the given trait.
1587 trait DoesNotImpl {
1588 const IMPLS: bool = false;
1589 }
1590 impl<T: ?Sized> DoesNotImpl for T {}
1591 /// Concrete type with `True` for `IMPLS` if the type implements the
1592 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1593 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1594 #[allow(dead_code)]
1595 impl<T: ?Sized + core::cmp::Eq> Wrapper<T> {
1596 const IMPLS: bool = true;
1597 }
1598 <Wrapper<Self>>::IMPLS
1599 } {
1600 traits = traits.union(::facet_core::MarkerTraits::EQ);
1601 }
1602 if {
1603 /// Fallback trait with `False` for `IMPLS` if the type does not
1604 /// implement the given trait.
1605 trait DoesNotImpl {
1606 const IMPLS: bool = false;
1607 }
1608 impl<T: ?Sized> DoesNotImpl for T {}
1609 /// Concrete type with `True` for `IMPLS` if the type implements the
1610 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1611 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1612 #[allow(dead_code)]
1613 impl<T: ?Sized + core::marker::Send> Wrapper<T> {
1614 const IMPLS: bool = true;
1615 }
1616 <Wrapper<Self>>::IMPLS
1617 } {
1618 traits = traits.union(::facet_core::MarkerTraits::SEND);
1619 }
1620 if {
1621 /// Fallback trait with `False` for `IMPLS` if the type does not
1622 /// implement the given trait.
1623 trait DoesNotImpl {
1624 const IMPLS: bool = false;
1625 }
1626 impl<T: ?Sized> DoesNotImpl for T {}
1627 /// Concrete type with `True` for `IMPLS` if the type implements the
1628 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1629 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1630 #[allow(dead_code)]
1631 impl<T: ?Sized + core::marker::Sync> Wrapper<T> {
1632 const IMPLS: bool = true;
1633 }
1634 <Wrapper<Self>>::IMPLS
1635 } {
1636 traits = traits.union(::facet_core::MarkerTraits::SYNC);
1637 }
1638 if {
1639 /// Fallback trait with `False` for `IMPLS` if the type does not
1640 /// implement the given trait.
1641 trait DoesNotImpl {
1642 const IMPLS: bool = false;
1643 }
1644 impl<T: ?Sized> DoesNotImpl for T {}
1645 /// Concrete type with `True` for `IMPLS` if the type implements the
1646 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1647 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1648 #[allow(dead_code)]
1649 impl<T: ?Sized + core::marker::Copy> Wrapper<T> {
1650 const IMPLS: bool = true;
1651 }
1652 <Wrapper<Self>>::IMPLS
1653 } {
1654 traits = traits.union(::facet_core::MarkerTraits::COPY);
1655 }
1656 if {
1657 /// Fallback trait with `False` for `IMPLS` if the type does not
1658 /// implement the given trait.
1659 trait DoesNotImpl {
1660 const IMPLS: bool = false;
1661 }
1662 impl<T: ?Sized> DoesNotImpl for T {}
1663 /// Concrete type with `True` for `IMPLS` if the type implements the
1664 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1665 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1666 #[allow(dead_code)]
1667 impl<T: ?Sized + core::marker::Unpin> Wrapper<T> {
1668 const IMPLS: bool = true;
1669 }
1670 <Wrapper<Self>>::IMPLS
1671 } {
1672 traits = traits.union(::facet_core::MarkerTraits::UNPIN);
1673 }
1674 builder = builder.marker_traits(traits);
1675 }
1676 if {
1677 /// Fallback trait with `False` for `IMPLS` if the type does not
1678 /// implement the given trait.
1679 trait DoesNotImpl {
1680 const IMPLS: bool = false;
1681 }
1682 impl<T: ?Sized> DoesNotImpl for T {}
1683 /// Concrete type with `True` for `IMPLS` if the type implements the
1684 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1685 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1686 #[allow(dead_code)]
1687 impl<T: ?Sized + core::cmp::PartialEq> Wrapper<T> {
1688 const IMPLS: bool = true;
1689 }
1690 <Wrapper<Self>>::IMPLS
1691 } {
1692 builder = builder.eq(|left, right| {
1693 use ::facet_core::spez::*;
1694 (&&Spez(unsafe { left.get::<Self>() }))
1695 .spez_eq(&&Spez(unsafe { right.get::<Self>() }))
1696 });
1697 }
1698 if {
1699 /// Fallback trait with `False` for `IMPLS` if the type does not
1700 /// implement the given trait.
1701 trait DoesNotImpl {
1702 const IMPLS: bool = false;
1703 }
1704 impl<T: ?Sized> DoesNotImpl for T {}
1705 /// Concrete type with `True` for `IMPLS` if the type implements the
1706 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1707 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1708 #[allow(dead_code)]
1709 impl<T: ?Sized + core::cmp::PartialOrd> Wrapper<T> {
1710 const IMPLS: bool = true;
1711 }
1712 <Wrapper<Self>>::IMPLS
1713 } {
1714 builder = builder.partial_ord(|left, right| {
1715 use ::facet_core::spez::*;
1716 (&&Spez(unsafe { left.get::<Self>() }))
1717 .spez_partial_cmp(&&Spez(unsafe { right.get::<Self>() }))
1718 });
1719 }
1720 if {
1721 /// Fallback trait with `False` for `IMPLS` if the type does not
1722 /// implement the given trait.
1723 trait DoesNotImpl {
1724 const IMPLS: bool = false;
1725 }
1726 impl<T: ?Sized> DoesNotImpl for T {}
1727 /// Concrete type with `True` for `IMPLS` if the type implements the
1728 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1729 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1730 #[allow(dead_code)]
1731 impl<T: ?Sized + core::cmp::Ord> Wrapper<T> {
1732 const IMPLS: bool = true;
1733 }
1734 <Wrapper<Self>>::IMPLS
1735 } {
1736 builder = builder.ord(|left, right| {
1737 use ::facet_core::spez::*;
1738 (&&Spez(unsafe { left.get::<Self>() }))
1739 .spez_cmp(&&Spez(unsafe { right.get::<Self>() }))
1740 });
1741 }
1742 if {
1743 /// Fallback trait with `False` for `IMPLS` if the type does not
1744 /// implement the given trait.
1745 trait DoesNotImpl {
1746 const IMPLS: bool = false;
1747 }
1748 impl<T: ?Sized> DoesNotImpl for T {}
1749 /// Concrete type with `True` for `IMPLS` if the type implements the
1750 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1751 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1752 #[allow(dead_code)]
1753 impl<T: ?Sized + core::hash::Hash> Wrapper<T> {
1754 const IMPLS: bool = true;
1755 }
1756 <Wrapper<Self>>::IMPLS
1757 } {
1758 builder = builder.hash(|value, hasher_this, hasher_write_fn| {
1759 use ::facet_core::HasherProxy;
1760 use ::facet_core::spez::*;
1761 (&&Spez(unsafe { value.get::<Self>() })).spez_hash(&mut unsafe {
1762 HasherProxy::new(hasher_this, hasher_write_fn)
1763 })
1764 });
1765 }
1766 if {
1767 /// Fallback trait with `False` for `IMPLS` if the type does not
1768 /// implement the given trait.
1769 trait DoesNotImpl {
1770 const IMPLS: bool = false;
1771 }
1772 impl<T: ?Sized> DoesNotImpl for T {}
1773 /// Concrete type with `True` for `IMPLS` if the type implements the
1774 /// given trait. Otherwise, it falls back to `DoesNotImpl`.
1775 struct Wrapper<T: ?Sized>(::core::marker::PhantomData<T>);
1776 #[allow(dead_code)]
1777 impl<T: ?Sized + core::str::FromStr> Wrapper<T> {
1778 const IMPLS: bool = true;
1779 }
1780 <Wrapper<Self>>::IMPLS
1781 } {
1782 builder = builder.parse(|s, target| {
1783 use ::facet_core::spez::*;
1784 let res = unsafe { (&&SpezEmpty::<Self>::SPEZ).spez_parse(s, target) };
1785 res.map(|_| unsafe { target.assume_init() })
1786 });
1787 }
1788 builder.build()
1789 },
1790 )
1791 .def(crate::Def::Enum(
1792 crate::EnumDef::builder()
1793 .variants(__facet_variants)
1794 .repr(crate::EnumRepr::U8)
1795 .build(),
1796 ))
1797 .doc(&[" A sub-enum used within `KitchenSinkEnum`."])
1798 .build()
1799 };
1800}