tokio-rs / valuable

MIT License
187 stars 20 forks source link

Implement valuable-serde #23

Closed taiki-e closed 3 years ago

taiki-e commented 3 years ago

Closes #17

Examples

use valuable::Valuable;
use valuable_serde::Serializable;

#[derive(Valuable)]
struct Point {
    x: i32,
    y: i32,
}

let point = Point { x: 1, y: 2 };

let value = Serializable::new(&point);

assert_eq!(
    serde_json::to_string(&value).unwrap(),
    r#"{"x":1,"y":2}"#,
);
taiki-e commented 3 years ago

I think this is now ready for review.

Currently, I'm aware of two differences in behavior from serde. See https://github.com/tokio-rs/valuable/pull/23#discussion_r632580027 and https://github.com/tokio-rs/valuable/pull/23#discussion_r634326038 for more.

taiki-e commented 3 years ago

filed https://github.com/tokio-rs/valuable/issues/42 to track remaining todos.