feat(tvix/castore): implement Ord for node::Node
This allows assembling BTreeSets of node::Node. Change-Id: I97b83be5ffc3e891307a8ef2b5fc31e38b747a62 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10625 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
parent
2750e1e640
commit
c5e2832cbd
1 changed files with 14 additions and 0 deletions
|
@ -159,6 +159,20 @@ impl node::Node {
|
|||
}
|
||||
}
|
||||
|
||||
impl Eq for node::Node {}
|
||||
|
||||
impl PartialOrd for node::Node {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
impl Ord for node::Node {
|
||||
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
|
||||
self.get_name().cmp(other.get_name())
|
||||
}
|
||||
}
|
||||
|
||||
/// Accepts a name, and a mutable reference to the previous name.
|
||||
/// If the passed name is larger than the previous one, the reference is updated.
|
||||
/// If it's not, an error is returned.
|
||||
|
|
Loading…
Reference in a new issue