facet_core/impls_std/
path.rs

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