snapbox::data

Trait ToDebug

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

Source

fn to_debug(&self) -> Data

Implementors§

Source§

impl<D: Debug> ToDebug for D