x_bow/impls/stdlib/
primitives.rs1use crate::impls::leaf::LeafPathBuilder;
2use crate::path::Path;
3use crate::trackable::Trackable;
4
5macro_rules! leaf_primitive {
6 ($ty:ty) => {
7 impl Trackable for $ty {
8 type PathBuilder<P: Path<Out = Self>> = LeafPathBuilder<P>;
9
10 fn new_path_builder<P: Path<Out = Self>>(parent: P) -> Self::PathBuilder<P> {
11 LeafPathBuilder::new(parent)
12 }
13 }
14 };
15}
16
17leaf_primitive!(bool);
18leaf_primitive!(char);
19leaf_primitive!(f32);
20leaf_primitive!(f64);
21leaf_primitive!(i128);
22leaf_primitive!(i16);
23leaf_primitive!(i32);
24leaf_primitive!(i64);
25leaf_primitive!(i8);
26leaf_primitive!(isize);
27leaf_primitive!(u128);
28leaf_primitive!(u16);
29leaf_primitive!(u32);
30leaf_primitive!(u64);
31leaf_primitive!(u8);
32leaf_primitive!(usize);
33leaf_primitive!(str);
34leaf_primitive!(());
35
36impl<'a> Trackable for &'a str {
37 type PathBuilder<P: Path<Out = Self>> = LeafPathBuilder<P>;
38
39 fn new_path_builder<P: Path<Out = Self>>(parent: P) -> Self::PathBuilder<P> {
40 LeafPathBuilder::new(parent)
41 }
42}