Trait DebugExt

Source
pub trait DebugExt<D> {
    // Provided method
    fn debug(&self) -> Carrier<'_, Self, D> { ... }
}
Expand description

A trait extension which adds a .debug() method like Path::display does this for any type. Its method returns an object that implements Debug and can be used for formatting.

Provided Methods§

Source

fn debug(&self) -> Carrier<'_, Self, D>

Returns a wrapper that implements Debug via CustomDebug.

Examples found in repository?
examples/custom_debug.rs (line 26)
24fn main() {
25    let numbers = [0, 1, 2, 3];
26    println!("{:?}", numbers.debug());
27
28    let strings = vec!["I", "am", "a", "custom", "debug"];
29    println!("{:?}", strings.debug());
30}

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§

Source§

impl<T, D> DebugExt<D> for T
where T: AttachDebug<D> + ?Sized,