summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-04-13 22:16:32 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-04-14 00:16:47 +0200
commit4afebbe9e4463a8da4ab6f86e0f8099f9aa2a3eb (patch)
treec7ab229c4666197bcbfe5d8abd6b54897d4fb312
parent1f515b1d0d1e2b32384ead5f5081db81451bd4f7 (diff)
downloadimag-4afebbe9e4463a8da4ab6f86e0f8099f9aa2a3eb.zip
imag-4afebbe9e4463a8da4ab6f86e0f8099f9aa2a3eb.tar.gz
Remove FilterLinksIter
Because the code is not used. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--lib/entry/libimagentrylink/src/internal.rs72
1 files changed, 0 insertions, 72 deletions
diff --git a/lib/entry/libimagentrylink/src/internal.rs b/lib/entry/libimagentrylink/src/internal.rs
index 0a22ee1..be979e0 100644
--- a/lib/entry/libimagentrylink/src/internal.rs
+++ b/lib/entry/libimagentrylink/src/internal.rs
@@ -237,38 +237,6 @@ pub mod iter {
GetIter(i, store)
}
- /// Turn this iterator into a FilterLinksIter that removes all entries that are not linked
- /// to any other entry, by filtering them out the iterator.
- ///
- /// This does _not_ remove the entries from the store.
- pub fn without_unlinked(self) -> FilterLinksIter<'a> {
- FilterLinksIter::new(self, Box::new(|links: &[Link]| links.len() > 0))
- }
-
- /// Turn this iterator into a FilterLinksIter that removes all entries that have less than
- /// `n` links to any other entries.
- ///
- /// This does _not_ remove the entries from the store.
- pub fn with_less_than_n_links(self, n: usize) -> FilterLinksIter<'a> {
- FilterLinksIter::new(self, Box::new(move |links: &[Link]| links.len() < n))
- }
-
- /// Turn this iterator into a FilterLinksIter that removes all entries that have more than
- /// `n` links to any other entries.
- ///
- /// This does _not_ remove the entries from the store.
- pub fn with_more_than_n_links(self, n: usize) -> FilterLinksIter<'a> {
- FilterLinksIter::new(self, Box::new(move |links: &[Link]| links.len() > n))
- }
-
- /// Turn this iterator into a FilterLinksIter that removes all entries where the predicate
- /// `F` returns false
- ///
- /// This does _not_ remove the entries from the store.
- pub fn filtered_for_links(self, f: Box<Fn(&[Link]) -> bool>) -> FilterLinksIter<'a> {
- FilterLinksIter::new(self, f)
- }
-
pub fn store(&self) -> &Store {
self.1
}
@@ -287,46 +255,6 @@ pub mod iter {
}
- /// An iterator helper that has a function F.
- ///
- /// If the function F returns `false` for the number of links, the entry is ignored, else it is
- /// taken.
- pub struct FilterLinksIter<'a>(GetIter<'a>, Box<Fn(&[Link]) -> bool>);
-
- impl<'a> FilterLinksIter<'a> {
- pub fn new(gi: GetIter<'a>, f: Box<Fn(&[Link]) -> bool>) -> FilterLinksIter<'a> {
- FilterLinksIter(gi, f)
- }
- }
-
- impl<'a> Iterator for FilterLinksIter<'a> {
- type Item = Result<FileLockEntry<'a>>;
-
- fn next(&mut self) -> Option<Self::Item> {
- use internal::InternalLinker;
-
- loop {
- match self.0.next() {
- Some(Ok(fle)) => {
- let links = match fle.get_internal_links() {
- Err(e) => return Some(Err(e)),
- Ok(links) => links.collect::<Vec<_>>(),
- };
- if !(self.1)(&links) {
- continue;
- } else {
- return Some(Ok(fle));
- }
- },
- Some(Err(e)) => return Some(Err(e)),
- None => break,
- }
- }
- None
- }
-
- }
-
}
impl InternalLinker for Entry {