• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

facet-rs / facet / 20108266382

10 Dec 2025 05:54PM UTC coverage: 57.724% (-0.8%) from 58.573%
20108266382

Pull #1220

github

web-flow
Merge 20d54c3e7 into fe1531898
Pull Request #1220: feat(cinereus): improve tree matching for leaf nodes and filter no-op moves

1769 of 3627 new or added lines in 18 files covered. (48.77%)

12 existing lines in 1 file now uncovered.

28569 of 49492 relevant lines covered (57.72%)

808.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

47.83
/facet-diff-core/src/path.rs
1
//! Path types for navigating diff trees.
2

3
use std::borrow::Cow;
4

5
/// A path segment describing how to reach a child.
6
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
7
pub enum PathSegment {
8
    /// A named field in a struct
9
    Field(Cow<'static, str>),
10
    /// An index in a list/array
11
    Index(usize),
12
    /// A key in a map
13
    Key(Cow<'static, str>),
14
    /// An enum variant
15
    Variant(Cow<'static, str>),
16
}
17

18
/// A path from root to a node.
19
#[derive(Debug, Clone, PartialEq, Eq, Default, Hash)]
20
pub struct Path(pub Vec<PathSegment>);
21

22
impl Path {
23
    /// Create a new empty path.
24
    pub fn new() -> Self {
5✔
25
        Self(Vec::new())
5✔
26
    }
5✔
27

28
    /// Append a segment to this path.
29
    pub fn push(&mut self, segment: PathSegment) {
10✔
30
        self.0.push(segment);
10✔
31
    }
10✔
32

33
    /// Create a new path with an additional segment.
34
    pub fn with(&self, segment: PathSegment) -> Self {
10✔
35
        let mut new = self.clone();
10✔
36
        new.push(segment);
10✔
37
        new
10✔
38
    }
10✔
39
}
40

41
impl core::fmt::Display for Path {
NEW
42
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
×
NEW
43
        for (i, segment) in self.0.iter().enumerate() {
×
NEW
44
            if i > 0 {
×
NEW
45
                write!(f, ".")?;
×
NEW
46
            }
×
NEW
47
            match segment {
×
NEW
48
                PathSegment::Field(name) => write!(f, "{}", name)?,
×
NEW
49
                PathSegment::Index(idx) => write!(f, "[{}]", idx)?,
×
NEW
50
                PathSegment::Key(key) => write!(f, "[{:?}]", key)?,
×
NEW
51
                PathSegment::Variant(name) => write!(f, "::{}", name)?,
×
52
            }
53
        }
NEW
54
        Ok(())
×
NEW
55
    }
×
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc