feat: Implement clone_box for head, tail, and skip filters

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-09-03 07:51:01 -03:00
parent 19188fabb9
commit 71d7ec0851
3 changed files with 38 additions and 0 deletions

View File

@@ -32,6 +32,12 @@ impl FilterPlugin for HeadBytesFilter {
}
Ok(())
}
fn clone_box(&self) -> Box<dyn FilterPlugin> {
Box::new(Self {
remaining: self.remaining,
})
}
}
pub struct HeadLinesFilter {
@@ -63,4 +69,10 @@ impl FilterPlugin for HeadLinesFilter {
}
Ok(())
}
fn clone_box(&self) -> Box<dyn FilterPlugin> {
Box::new(Self {
remaining: self.remaining,
})
}
}

View File

@@ -54,6 +54,12 @@ impl FilterPlugin for SkipBytesFilter {
std::io::copy(&mut *reader, &mut *writer)?;
Ok(())
}
fn clone_box(&self) -> Box<dyn FilterPlugin> {
Box::new(Self {
remaining: self.remaining,
})
}
}
pub struct SkipLinesFilter {
@@ -102,4 +108,10 @@ impl FilterPlugin for SkipLinesFilter {
}
Ok(())
}
fn clone_box(&self) -> Box<dyn FilterPlugin> {
Box::new(Self {
remaining: self.remaining,
})
}
}

View File

@@ -61,6 +61,13 @@ impl FilterPlugin for TailBytesFilter {
(&mut *writer).write_all(&result)?;
Ok(())
}
fn clone_box(&self) -> Box<dyn FilterPlugin> {
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<dyn FilterPlugin> {
Box::new(Self {
lines: self.lines.clone(),
count: self.count,
})
}
}