Skip to main content

IntoJson

Trait IntoJson 

pub trait IntoJson {
    // Required method
    fn into_json(self) -> Data;
}
Expand description

Capture the serde representation of a value

§Examples

use snapbox::IntoJson as _;

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

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

Required Methods§

fn into_json(self) -> Data

Implementors§

§

impl<S> IntoJson for S
where S: Serialize,

Available on crate feature json only.