kvarn::prelude::internals::prelude

Trait AsCleanDebug

source
pub trait AsCleanDebug {
    // Provided method
    fn as_clean(&self) -> CleanDebug<'_, Self>
       where Self: Display { ... }
}
Expand description

Trait to enable .as_clean to get a CleanDebug for the variable.

Provided Methods§

source

fn as_clean(&self) -> CleanDebug<'_, Self>
where Self: Display,

Get a CleanDebug for Self.

§Examples
let s = "a\tstring";
let clean_debug = s.as_clean();

// A debug formatting is the same as the value itself.
assert_eq!(format!("{:?}", clean_debug), s);

// The debug formatting of the `&str` is messy for clean output in debug implementations.
assert_eq!(format!("{:?}", s), r#""a\tstring""#)

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> AsCleanDebug for T
where T: Display,