Trait Debuggable

Source
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§

Source

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:

  1. Representations must not end in a newline.
  2. All lines after the first (but not the first) must start with the provided prefix.

Provided Methods§

Source

fn write_debug<WriteT>(&self, writer: &mut WriteT) -> Result<()>
where WriteT: Write,

Write the debug representation with the default theme and a final newline.

Source

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.

Source

fn print_debug(&self)

Print the debug representation to anstream::stdout with the default theme and a final newline.

Panics on write Error.

Source

fn print_debug_plain(&self)

Print the debug representation to stdout with the plain theme and a final newline.

Panics on write Error.

Source

fn eprint_debug(&self)

Print the debug representation to anstream::stderr with the default theme and a final newline.

Panics on write Error.

Source

fn eprint_debug_plain(&self)

Print the debug representation to stderr with the plain theme and a final newline.

Panics on write Error.

Source

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.

Implementors§