feat: Implement clone_box for StripAnsiFilter and GrepFilter
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -27,4 +27,10 @@ impl FilterPlugin for GrepFilter {
|
|||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clone_box(&self) -> Box<dyn FilterPlugin> {
|
||||||
|
Box::new(Self {
|
||||||
|
regex: self.regex.clone(),
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ pub mod utils;
|
|||||||
|
|
||||||
pub trait FilterPlugin: Send {
|
pub trait FilterPlugin: Send {
|
||||||
fn filter(&mut self, reader: Box<&mut dyn Read>, writer: Box<&mut dyn Write>) -> Result<()>;
|
fn filter(&mut self, reader: Box<&mut dyn Read>, writer: Box<&mut dyn Write>) -> Result<()>;
|
||||||
|
fn clone_box(&self) -> Box<dyn FilterPlugin>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, EnumString, strum::VariantNames)]
|
#[derive(Debug, EnumString, strum::VariantNames)]
|
||||||
|
|||||||
@@ -16,4 +16,8 @@ impl FilterPlugin for StripAnsiFilter {
|
|||||||
std::io::copy(&mut *reader, &mut ansi_writer)?;
|
std::io::copy(&mut *reader, &mut ansi_writer)?;
|
||||||
ansi_writer.flush()
|
ansi_writer.flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clone_box(&self) -> Box<dyn FilterPlugin> {
|
||||||
|
Box::new(Self)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user