pub trait Manifest<A> {
type Error;
// Required method
fn manifest(&self, ast: &A) -> Result<impl Display, Self::Error>;
// Provided methods
fn write_fmt<W: Write>(
&self,
ast: &A,
writer: W,
) -> Result<(), FmtRenderError<Self::Error>> { ... }
fn write_io<W: Write>(
&self,
ast: &A,
writer: W,
) -> Result<(), IORenderError<Self::Error>> { ... }
}Expand description
A manifest knows how to display an Ast.
Often, you can use a provided implementation.
Manifest implementations typically contain state which determine how the string is displayed.
§Mutable state
A Manifest implementation is not provided a mutable self-reference. In order to maintain
mutable state which lasts for a single render of a template, implement ManifestMut
instead.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn write_fmt<W: Write>(
&self,
ast: &A,
writer: W,
) -> Result<(), FmtRenderError<Self::Error>>
fn write_fmt<W: Write>( &self, ast: &A, writer: W, ) -> Result<(), FmtRenderError<Self::Error>>
Write the Ast into a fmt::Write implementation.
The default implementation calls write!(writer, "{}", self.manifest(ast)).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.