hydrate_schema/property_path.rs
1#[derive(Default, Clone)]
2pub struct PropertyPath(String);
3
4impl PropertyPath {
5 pub fn push(
6 &self,
7 str: &str,
8 ) -> PropertyPath {
9 if self.0.is_empty() {
10 PropertyPath(str.to_string())
11 } else if str.is_empty() {
12 PropertyPath(self.0.to_string())
13 } else {
14 PropertyPath(format!("{}.{}", self.0, str))
15 }
16 }
17
18 pub fn path(&self) -> &str {
19 &self.0
20 }
21}