diff options
author | Till Höppner | 2016-02-23 17:00:53 +0100 |
---|---|---|
committer | Till Höppner | 2016-02-24 18:36:04 +0100 |
commit | f01c278a26e0f248d188c10bdb852b0859b98b3b (patch) | |
tree | 3e729bf243011111a20b84f24aea3fbcb9f595f5 /src/ageset.rs | |
parent | 815f31f5cef61709c50087c9f7601ea330929bb7 (diff) | |
download | ilc-f01c278a26e0f248d188c10bdb852b0859b98b3b.tar.gz ilc-f01c278a26e0f248d188c10bdb852b0859b98b3b.tar.xz ilc-f01c278a26e0f248d188c10bdb852b0859b98b3b.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; + } } } |