pub trait OutputFormatter {
// Required methods
fn format_result(&self, result: &GrepResult) -> Result<String>;
fn format_results(&self, results: &[GrepResult]) -> Result<String>;
// Provided methods
fn print_result(&self, result: &GrepResult) -> Result<()> { ... }
fn print_results(&self, results: &[GrepResult]) -> Result<()> { ... }
}Expand description
Trait for output formatters
Required Methods§
Sourcefn format_result(&self, result: &GrepResult) -> Result<String>
fn format_result(&self, result: &GrepResult) -> Result<String>
Format a single grep result
Sourcefn format_results(&self, results: &[GrepResult]) -> Result<String>
fn format_results(&self, results: &[GrepResult]) -> Result<String>
Format multiple grep results
Provided Methods§
Sourcefn print_result(&self, result: &GrepResult) -> Result<()>
fn print_result(&self, result: &GrepResult) -> Result<()>
Print a result directly to stdout
Sourcefn print_results(&self, results: &[GrepResult]) -> Result<()>
fn print_results(&self, results: &[GrepResult]) -> Result<()>
Print multiple results directly to stdout
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".