pub trait Debuggable {
// Required method
fn write_debug_representation<WriteT>(
&self,
writer: &mut WriteT,
prefix: &DebugPrefix,
theme: &Theme,
) -> Result<()>
where WriteT: Write;
// Provided methods
fn write_debug<WriteT>(&self, writer: &mut WriteT) -> Result<()>
where WriteT: Write { ... }
fn write_debug_plain<WriteT>(&self, writer: &mut WriteT) -> Result<()>
where WriteT: Write { ... }
fn print_debug(&self) { ... }
fn print_debug_plain(&self) { ... }
fn eprint_debug(&self) { ... }
fn eprint_debug_plain(&self) { ... }
fn to_debug_string(&self, theme: &Theme) -> Result<String> { ... }
}Expand description
Can write a debug representation of itself that can be indented, styled, and multiline.
Designed to support complex nested hierarchies.
Required Methods§
Sourcefn write_debug_representation<WriteT>(
&self,
writer: &mut WriteT,
prefix: &DebugPrefix,
theme: &Theme,
) -> Result<()>where
WriteT: Write,
fn write_debug_representation<WriteT>(
&self,
writer: &mut WriteT,
prefix: &DebugPrefix,
theme: &Theme,
) -> Result<()>where
WriteT: Write,
Write the debug representation.
Required behavior for implementations:
- Representations must not end in a newline.
- All lines after the first (but not the first) must start with the provided prefix.
Provided Methods§
Sourcefn write_debug<WriteT>(&self, writer: &mut WriteT) -> Result<()>where
WriteT: Write,
fn write_debug<WriteT>(&self, writer: &mut WriteT) -> Result<()>where
WriteT: Write,
Write the debug representation with the default theme and a final newline.
Sourcefn write_debug_plain<WriteT>(&self, writer: &mut WriteT) -> Result<()>where
WriteT: Write,
fn write_debug_plain<WriteT>(&self, writer: &mut WriteT) -> Result<()>where
WriteT: Write,
Write the debug representation with the plain theme and a final newline.
Sourcefn print_debug(&self)
fn print_debug(&self)
Print the debug representation to anstream::stdout with the default theme and a final newline.
Panics on write Error.
Sourcefn print_debug_plain(&self)
fn print_debug_plain(&self)
Sourcefn eprint_debug(&self)
fn eprint_debug(&self)
Print the debug representation to anstream::stderr with the default theme and a final newline.
Panics on write Error.
Sourcefn eprint_debug_plain(&self)
fn eprint_debug_plain(&self)
Sourcefn to_debug_string(&self, theme: &Theme) -> Result<String>
fn to_debug_string(&self, theme: &Theme) -> Result<String>
Capture write_debug_representation into a string.
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.