summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-02-21 19:37:40 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-02-21 19:37:40 +0100
commit7dfb01e48db94c098d61286f6f428c70ad08fc98 (patch)
tree29ae6ef280681cdf4b9bb5fe941c5e8c2022f443
parent2aa09879cc7a7d61efde85658520b5bd7a8a8872 (diff)
Back to the first version apparently
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--bin/domain/imag-mail/src/lib.rs30
1 files changed, 13 insertions, 17 deletions
diff --git a/bin/domain/imag-mail/src/lib.rs b/bin/domain/imag-mail/src/lib.rs
index f9bc966a..2af2055e 100644
--- a/bin/domain/imag-mail/src/lib.rs
+++ b/bin/domain/imag-mail/src/lib.rs
@@ -201,8 +201,8 @@ fn list(rt: &Runtime) -> Result<()> {
where I: Iterator<Item = Result<FileLockEntry<'a>>>
{
debug!("Processing tree");
- let ids : Vec<_> = if find_root {
- iter.and_then_ok(|fle| {
+ let iter = if find_root {
+ let iter = iter.and_then_ok(|fle| {
trace!("Loading: {}", fle.get_location());
let id = fle
.load(conn)?
@@ -214,25 +214,21 @@ fn list(rt: &Runtime) -> Result<()> {
drop(fle);
id
- })
+ });
- // we have to collect here, so that all FLEs are drop()ed
- .collect::<Result<Vec<String>>>()?
- .into_iter()
- .map(|id: String| mailstore.get_mailtree(&id))
- .collect::<Result<Vec<Mailtree>>>()
+ Box::new(iter) as Box<dyn Iterator<Item = Result<String>>>
} else {
- iter.and_then_ok(|fle| fle.get_cached_id())
- // we have to collect here, so that all FLEs are drop()ed
- .collect::<Result<Vec<String>>>()?
- .into_iter()
- .map(|id: String| mailstore.get_mailtree(&id))
- .collect::<Result<Vec<Mailtree>>>()
- }?;
+ let iter = iter.and_then_ok(|fle| fle.get_cached_id());
+ Box::new(iter) as Box<dyn Iterator<Item = Result<String>>>
+ };
trace!("Printing mailtrees now!");
- ids.into_iter()
- .map(|mt| print_traverse(&mailstore, mt, i, conn, list_format, rt, out))
+
+ // we have to collect here, so that all FLEs are drop()ed
+ iter.collect::<Result<Vec<String>>>()?
+ .into_iter()
+ .map(|id: String| mailstore.get_mailtree(&id))
+ .and_then_ok(|mt| print_traverse(&mailstore, mt, i, conn, list_format, rt, out))
.collect::<Result<Vec<_>>>()
.map(|_| ())
}