Skip to main content

ToDebug

Trait ToDebug 

pub trait ToDebug {
    // Required method
    fn to_debug(&self) -> Data;
}
Expand description

Capture the pretty debug representation of a value

Note: this is fairly brittle as debug representations are not generally subject to semver guarantees.

use snapbox::ToDebug as _;

fn some_function() -> usize {
    // ...
}

let actual = some_function();
let expected = snapbox::str![["5"]];
snapbox::assert_data_eq!(actual.to_debug(), expected);

Required Methods§

fn to_debug(&self) -> Data

Implementors§

§

impl<D> ToDebug for D
where D: Debug,