#[derive(serde::Serialize)] struct Foo { s: String, } #[derive(serde::Deserialize)] struct Bar { s: String, } #[test] fn transmute() { let settings = Default::default(); let foo = Foo { s: String::from("Hello!") }; let bar: Bar = serde_transmute::transmute(&foo, &settings).unwrap(); assert_eq!(foo.s, bar.s); }