Created
July 17, 2019 11:44
-
-
Save andreastt/80e78ded11aefb03f8a6a7720a8d7f7d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn from_value<'de, D, T>(deserializer: D) -> Result<T, D::Error> | |
where | |
D: Deserializer<'de>, | |
T: serde::de::DeserializeOwned, | |
{ | |
#[derive(Debug, Deserialize)] | |
struct Wrapper<T> { | |
value: T, | |
} | |
let val = Wrapper::deserialize(deserializer) | |
.map_err(de::Error::custom)?; | |
Ok(val.value) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment