From 71d7ec0851fbdfcfbf1134aaf9c092a3e159bf49 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Wed, 3 Sep 2025 07:51:01 -0300 Subject: [PATCH] feat: Implement `clone_box` for head, tail, and skip filters Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) --- src/filter_plugin/head.rs | 12 ++++++++++++ src/filter_plugin/skip.rs | 12 ++++++++++++ src/filter_plugin/tail.rs | 14 ++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/src/filter_plugin/head.rs b/src/filter_plugin/head.rs index 25cef4c..2c21e29 100644 --- a/src/filter_plugin/head.rs +++ b/src/filter_plugin/head.rs @@ -32,6 +32,12 @@ impl FilterPlugin for HeadBytesFilter { } Ok(()) } + + fn clone_box(&self) -> Box { + Box::new(Self { + remaining: self.remaining, + }) + } } pub struct HeadLinesFilter { @@ -63,4 +69,10 @@ impl FilterPlugin for HeadLinesFilter { } Ok(()) } + + fn clone_box(&self) -> Box { + Box::new(Self { + remaining: self.remaining, + }) + } } diff --git a/src/filter_plugin/skip.rs b/src/filter_plugin/skip.rs index 783118f..7112cd4 100644 --- a/src/filter_plugin/skip.rs +++ b/src/filter_plugin/skip.rs @@ -54,6 +54,12 @@ impl FilterPlugin for SkipBytesFilter { std::io::copy(&mut *reader, &mut *writer)?; Ok(()) } + + fn clone_box(&self) -> Box { + Box::new(Self { + remaining: self.remaining, + }) + } } pub struct SkipLinesFilter { @@ -102,4 +108,10 @@ impl FilterPlugin for SkipLinesFilter { } Ok(()) } + + fn clone_box(&self) -> Box { + Box::new(Self { + remaining: self.remaining, + }) + } } diff --git a/src/filter_plugin/tail.rs b/src/filter_plugin/tail.rs index b80a854..072229e 100644 --- a/src/filter_plugin/tail.rs +++ b/src/filter_plugin/tail.rs @@ -61,6 +61,13 @@ impl FilterPlugin for TailBytesFilter { (&mut *writer).write_all(&result)?; Ok(()) } + + fn clone_box(&self) -> Box { + Box::new(Self { + buffer: self.buffer.clone(), + count: self.count, + }) + } } pub struct TailLinesFilter { @@ -115,4 +122,11 @@ impl FilterPlugin for TailLinesFilter { } Ok(()) } + + fn clone_box(&self) -> Box { + Box::new(Self { + lines: self.lines.clone(), + count: self.count, + }) + } }