[−][src]Trait hyperbole::field::IsoEncode
Types with an alternate representation that is Serialize.
For hlists, the serialization format is equivalent to a struct with the same fields:
use hyperbole::{field::IsoEncode, r}; use serde::Serialize; #[derive(Serialize)] struct MyRequest { a: String, b: u32, c: f32, } let my_req = serde_json::to_string(&MyRequest { a: "hello-worldo".into(), b: 32324, c: 345345.34, }) .unwrap(); let my_req_r = serde_json::to_string( &r! { a = "hello-worldo".to_string(), b = 32324, c = 345345.34, } .as_repr(), ) .unwrap(); // both of the above serialize to: let repr = r#"{"a":"hello-worldo","b":32324,"c":345345.34}"#; assert_eq!(repr, my_req); assert_eq!(repr, my_req_r);