pub trait Renderer {
// Required method
fn render(
&self,
writer: &mut dyn Write,
data: &DisplayData<'_>,
term_info: Option<&Term>,
) -> Result<()>;
}
Expand description
An interface that renders given diff data.
Required Methods§
Sourcefn render(
&self,
writer: &mut dyn Write,
data: &DisplayData<'_>,
term_info: Option<&Term>,
) -> Result<()>
fn render( &self, writer: &mut dyn Write, data: &DisplayData<'_>, term_info: Option<&Term>, ) -> Result<()>
Render a diff.
We use anyhow for errors so errors are free form for implementors, as they are not recoverable.
writer
can be any generic writer - it’s not guaranteed that we’re writing to a particular sink (could be a
pager, stdout, etc). data
is the data that the renderer needs to display, this has information about the
document being written out. term_info
is an optional reference to a term object that can be used by the
renderer to access information about the terminal if the current process is a TTY output.