use super::*; use std::cmp::Ordering; #[derive(PartialEq, Eq)] pub struct DirectoryChild { pub byte_path: Vec, pub entry_type: EntryType, } impl PartialOrd for DirectoryChild { fn partial_cmp(&self, other: &Self) -> Option { let entry_type_ord = self.entry_type.cmp(&other.entry_type); let final_order = match entry_type_ord { Ordering::Equal => self.byte_path.cmp(&other.byte_path), _ => entry_type_ord, }; Some(final_order) } } impl Ord for DirectoryChild { fn cmp(&self, other: &Self) -> Ordering { let entry_type_ord = self.entry_type.cmp(&other.entry_type); match entry_type_ord { Ordering::Equal => self.byte_path.cmp(&other.byte_path), _ => entry_type_ord, } } }