facet_core/impls_std/
path.rs

1use crate::*;
2
3unsafe impl Facet<'_> for std::path::PathBuf {
4    const VTABLE: &'static ValueVTable = &const {
5        value_vtable!(std::path::PathBuf, |f, _opts| write!(
6            f,
7            "{}",
8            Self::SHAPE.type_identifier
9        ))
10    };
11
12    const SHAPE: &'static Shape<'static> = &const {
13        Shape::builder_for_sized::<Self>()
14            .type_identifier("PathBuf")
15            .ty(Type::User(UserType::Opaque))
16            .def(Def::Scalar(
17                ScalarDef::builder()
18                    .affinity(&const { ScalarAffinity::path().build() })
19                    .build(),
20            ))
21            .build()
22    };
23}
24
25unsafe impl Facet<'_> for std::path::Path {
26    const VTABLE: &'static ValueVTable = &const {
27        value_vtable_unsized!(std::path::Path, |f, _opts| write!(
28            f,
29            "{}",
30            Self::SHAPE.type_identifier
31        ))
32    };
33
34    const SHAPE: &'static Shape<'static> = &const {
35        Shape::builder_for_unsized::<Self>()
36            .type_identifier("Path")
37            .ty(Type::User(UserType::Opaque))
38            .def(Def::Scalar(
39                ScalarDef::builder()
40                    .affinity(&const { ScalarAffinity::path().build() })
41                    .build(),
42            ))
43            .build()
44    };
45}