diff options
author | Till Höppner | 2016-02-23 17:00:53 +0100 |
---|---|---|
committer | Till Höppner | 2016-02-24 18:21:24 +0100 |
commit | e866dceae987acd51d43bd457351bd2188c5f95a (patch) | |
tree | 2cc5a67492bdf00ff68041656a1e870b2b4de17f /src/ageset.rs | |
parent | 815f31f5cef61709c50087c9f7601ea330929bb7 (diff) | |
download | ilc-e866dceae987acd51d43bd457351bd2188c5f95a.tar.gz ilc-e866dceae987acd51d43bd457351bd2188c5f95a.tar.xz ilc-e866dceae987acd51d43bd457351bd2188c5f95a.zip |
Test CI
Diffstat (limited to 'src/ageset.rs')
-rw-r--r-- | src/ageset.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/ageset.rs b/src/ageset.rs index 084afba..c97240f 100644 --- a/src/ageset.rs +++ b/src/ageset.rs @@ -9,14 +9,16 @@ use blist::BList; /// if the criteria is met. pub struct AgeSet<T> { fifo: BList<T>, - set: HashSet<T> + set: HashSet<T>, } -impl<T> AgeSet<T> where T: Eq + Hash + Clone { +impl<T> AgeSet<T> + where T: Eq + Hash + Clone +{ pub fn new() -> Self { AgeSet { fifo: BList::new(), - set: HashSet::new() + set: HashSet::new(), } } @@ -24,13 +26,17 @@ impl<T> AgeSet<T> where T: Eq + Hash + Clone { self.set.contains(t) } - pub fn prune<F>(&mut self, kill: F) where F: Fn(&T) -> bool { + pub fn prune<F>(&mut self, kill: F) + where F: Fn(&T) -> bool + { while let Some(ref e) = self.fifo.front().map(T::clone) { if kill(&e) { let removed = self.fifo.pop_front().unwrap(); self.set.remove(&e); assert!(*e == removed); - } else { break } + } else { + break; + } } } |