pub trait Print {
// Required method
fn print(&self, out: &mut dyn Write) -> Result;
// Provided method
fn to_source(&self) -> Result<String> { ... }
}Expand description
Write a value in the source spelling accepted by its Parse
implementation.
Implementations must round-trip: parsing the printed text yields a value
equal to self. When no such spelling exists, return fmt::Error rather
than writing text that would parse differently.
fmt::Formatter implements fmt::Write, so a Display impl can
forward to print.
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".