summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
authorMalte Voos <git@mal.tc>2025-11-21 23:29:22 +0100
committerMalte Voos <git@mal.tc>2025-11-21 23:29:22 +0100
commitbdff08776bebe55ac124172d506d6cf08f75bd88 (patch)
tree5e57f18c1dd9e03fe88bd16109557e97d6c2f9f0 /src/util
parent90a1d5729c32910c249460cfe56ad682fd3fd608 (diff)
downloadlleap-bdff08776bebe55ac124172d506d6cf08f75bd88.tar.gz
lleap-bdff08776bebe55ac124172d506d6cf08f75bd88.zip
remove OptionTracker
Diffstat (limited to 'src/util')
-rw-r--r--src/util/mod.rs2
-rw-r--r--src/util/option_tracker.rs43
2 files changed, 0 insertions, 45 deletions
diff --git a/src/util/mod.rs b/src/util/mod.rs
index 600d572..4d19eff 100644
--- a/src/util/mod.rs
+++ b/src/util/mod.rs
@@ -1,5 +1,3 @@
-mod option_tracker;
 mod tracker;
 
-pub use option_tracker::OptionTracker;
 pub use tracker::Tracker;
diff --git a/src/util/option_tracker.rs b/src/util/option_tracker.rs
deleted file mode 100644
index 3c19ee5..0000000
--- a/src/util/option_tracker.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-pub struct OptionTracker<T> {
-    inner: Option<T>,
-    dirty: bool,
-}
-
-/// Tracks changes to an inner Option<T>. Any change using `set` will cause the
-/// tracker to be marked as dirty, unless both the current and new value are
-/// `None`. This should be used when changes from `Some(something)` to
-/// `Some(something_different)` are rare, or when comparing inner values is more
-/// expensive than performing an update which will mark the tracker as clean.
-impl<T> OptionTracker<T> {
-    pub fn new(inner: Option<T>) -> Self {
-        Self { inner, dirty: true }
-    }
-
-    pub fn get(&self) -> &Option<T> {
-        &self.inner
-    }
-
-    pub fn set(&mut self, value: Option<T>) {
-        match (&self.inner, &value) {
-            (None, None) => {}
-            _ => self.dirty = true,
-        }
-
-        self.inner = value;
-    }
-
-    pub fn is_dirty(&self) -> bool {
-        self.dirty
-    }
-
-    /// Marks the tracker as clean.
-    pub fn reset(&mut self) {
-        self.dirty = false;
-    }
-}
-
-impl<T> Default for OptionTracker<T> {
-    fn default() -> Self {
-        Self::new(Option::default())
-    }
-}