Crates.io | serde_cast |
lib.rs | serde_cast |
version | 1.0.1 |
source | src |
created_at | 2023-11-09 14:27:12.07721 |
updated_at | 2023-11-09 14:30:15.965282 |
description | Simple A to B cast |
homepage | https://github.com/5GameMaker/serde_cast |
repository | https://github.com/5GameMaker/serde_cast |
max_upload_size | |
id | 1030196 |
size | 5,600 |
Works nicely with
you_can
!
A
and B
Serialize
and Deserialize
respectivelyuse serde::{Serialize, Deserialize};
use serde_cast::serde_cast;
#[derive(Serialize)]
struct A {
field: String,
}
#[derive(Deserialize)]
struct B {
field: String,
}
let a = A { field: "This was a mistake".to_string() };
let b: B = serde_cast!(&a);
assert_eq!(a.field, b.field);