aboutsummaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
Diffstat (limited to 'src/output')
-rw-r--r--src/output/aggregators.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/output/aggregators.rs b/src/output/aggregators.rs
index 4fa2558..24adbf8 100644
--- a/src/output/aggregators.rs
+++ b/src/output/aggregators.rs
@@ -15,7 +15,8 @@ use std::{
pub trait Aggregator: Sync {
fn push_item(&self, item: LogResult, format: &dyn Format, stream: &mut dyn Write);
- fn finish(self, format: &dyn Format, stream: &mut dyn Write);
+ // When the `unsized_locals` feature is stable, we could rewrite this to finish(self, ...).
+ fn finish(self: Box<Self>, format: &dyn Format, stream: &mut dyn Write);
}
/// An aggregator that just pushes through each item to the output stream without any sorting or
@@ -29,7 +30,7 @@ impl Aggregator for WriteThrough {
stream.flush().unwrap();
}
- fn finish(self, _: &dyn Format, _: &mut dyn Write) {}
+ fn finish(self: Box<Self>, _: &dyn Format, _: &mut dyn Write) {}
}
/// An aggregator that keeps all found logs in memory and sorts them before outputting them.
@@ -53,8 +54,8 @@ impl Aggregator for SortedOutput {
self.items.lock().unwrap().push(item)
}
- fn finish(self, format: &dyn Format, stream: &mut dyn Write) {
- let SortedOutput { sorting, items } = self;
+ fn finish(self: Box<Self>, format: &dyn Format, stream: &mut dyn Write) {
+ let SortedOutput { sorting, items } = *self;
let mut items = items.into_inner().unwrap();
items.sort_unstable_by(|a, b| sorting.cmp(a, b));
for item in items {