facet_core/impls_std/
path.rs

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