[−][src]Trait hyperbole::field::IsoDecode
Types with an alternate representation that is DeserializeOwned.
For hlists, the deserialization format is equivalent to a struct with the same fields:
use hyperbole::{field::IsoDecode, zoom, R}; use serde::Deserialize; #[derive(Deserialize)] struct MyRequest { a: String, b: u32, c: f32, } let repr = r#"{"a":"hello-worldo","b":32324,"c":345345.34}"#; let my_req: MyRequest = serde_json::from_str(repr).unwrap(); let my_req_r: R![a: String, b: u32, c: f32] = serde_json::from_str(repr) .map(IsoDecode::from_repr) .unwrap(); assert_eq!(my_req.a, *zoom![&my_req_r.a]); assert_eq!(my_req.b, *zoom![&my_req_r.b]); assert_eq!(my_req.c, *zoom![&my_req_r.c]);
Associated Types
type Repr: DeserializeOwned
The representation.