summaryrefslogtreecommitdiff
path: root/src/devices/file/directory_child.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/file/directory_child.rs')
-rw-r--r--src/devices/file/directory_child.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/devices/file/directory_child.rs b/src/devices/file/directory_child.rs
new file mode 100644
index 0000000..376ec7d
--- /dev/null
+++ b/src/devices/file/directory_child.rs
@@ -0,0 +1,35 @@
+use super::*;
+
+use std::cmp::Ordering;
+
+
+pub struct DirectoryChild {
+ pub path: BedrockFilePath,
+ pub entry_type: EntryType,
+}
+
+
+// ---------------------------------------------------------------------------
+
+impl PartialEq for DirectoryChild {
+ fn eq(&self, other: &Self) -> bool {
+ self.entry_type == other.entry_type && self.path == other.path
+ }
+}
+
+impl Eq for DirectoryChild {}
+
+impl PartialOrd for DirectoryChild {
+ fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
+ Some(self.cmp(other))
+ }
+}
+
+impl Ord for DirectoryChild {
+ fn cmp(&self, other: &Self) -> Ordering {
+ match self.entry_type.cmp(&other.entry_type) {
+ Ordering::Equal => self.path.cmp(&other.path),
+ ordering => ordering,
+ }
+ }
+}