aboutsummaryrefslogtreecommitdiff
path: root/src/ageset.rs
diff options
context:
space:
mode:
authorTill Höppner2016-02-23 17:00:53 +0100
committerTill Höppner2016-02-24 18:36:04 +0100
commitf01c278a26e0f248d188c10bdb852b0859b98b3b (patch)
tree3e729bf243011111a20b84f24aea3fbcb9f595f5 /src/ageset.rs
parent815f31f5cef61709c50087c9f7601ea330929bb7 (diff)
downloadilc-f01c278a26e0f248d188c10bdb852b0859b98b3b.tar.gz
ilc-f01c278a26e0f248d188c10bdb852b0859b98b3b.tar.xz
ilc-f01c278a26e0f248d188c10bdb852b0859b98b3b.zip
Test CI
Diffstat (limited to 'src/ageset.rs')
-rw-r--r--src/ageset.rs16
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;
+ }
}
}