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 = &const {
13        Shape::builder_for_sized::<Self>()
14            .type_identifier("PathBuf")
15            .ty(Type::User(UserType::Opaque))
16            .def(Def::Scalar)
17            .build()
18    };
19}
20
21unsafe impl Facet<'_> for std::path::Path {
22    const VTABLE: &'static ValueVTable = &const {
23        value_vtable_unsized!(std::path::Path, |f, _opts| write!(
24            f,
25            "{}",
26            Self::SHAPE.type_identifier
27        ))
28    };
29
30    const SHAPE: &'static Shape = &const {
31        Shape::builder_for_unsized::<Self>()
32            .type_identifier("Path")
33            .ty(Type::User(UserType::Opaque))
34            .def(Def::Scalar)
35            .build()
36    };
37}