Function deser_hjson::from_str
source · pub fn from_str<T>(s: &str) -> Result<T>where
T: DeserializeOwned,
Expand description
Deserialize an instance of type T
from a string of Hjson text
Example
use serde::Deserialize;
#[derive(Deserialize, Debug)]
struct User {
hands: Option<u16>,
location: String,
}
// The type of `j` is `&str`
let j = "
hands: 2
location: Menlo Park, CA
";
let u: User = deser_hjson::from_str(j).unwrap();
println!("{:#?}", u);