1use crate::{Def, ScalarAffinity, ScalarDef, ValueVTable, value_vtable};
2use crate::{Facet, Shape, Type, UserType};
3
4#[repr(transparent)]
6pub struct Opaque<T>(pub T);
7
8unsafe impl<'a, T: 'a> Facet<'a> for Opaque<T> {
9 const VTABLE: &'static ValueVTable =
12 &const { value_vtable!((), |f, _opts| write!(f, "Opaque")) };
13
14 const SHAPE: &'static Shape<'static> = &const {
15 Shape::builder_for_sized::<Self>()
16 .ty(Type::User(UserType::Opaque))
17 .def(Def::Scalar(
18 ScalarDef::builder()
19 .affinity(&const { ScalarAffinity::opaque().build() })
20 .build(),
21 ))
22 .build()
23 };
24}