facet_core/impls_std/
path.rs1use crate::*;
2use core::alloc::Layout;
3use typeid::ConstTypeId;
4
5unsafe impl Facet<'_> for std::path::PathBuf {
6 const SHAPE: &'static Shape = &const {
7 Shape::builder()
8 .id(ConstTypeId::of::<Self>())
9 .layout(Layout::new::<Self>())
10 .def(Def::Scalar(
11 ScalarDef::builder()
12 .affinity(ScalarAffinity::path().build())
13 .build(),
14 ))
15 .vtable(value_vtable!((), |f, _opts| write!(f, "PathBuf")))
16 .build()
17 };
18}
19
20unsafe impl<'a> Facet<'a> for &'a std::path::Path {
21 const SHAPE: &'static Shape = &const {
22 Shape::builder()
23 .id(ConstTypeId::of::<Self>())
24 .layout(Layout::new::<Self>())
25 .def(Def::Scalar(
26 ScalarDef::builder()
27 .affinity(ScalarAffinity::path().build())
28 .build(),
29 ))
30 .vtable(value_vtable!((), |f, _opts| write!(f, "Path")))
31 .build()
32 };
33}