Function from_str

Source
pub fn from_str<'a, T>(s: &'a str) -> Result<T, ParseError>
where T: Deserialize<'a>,
Expand description

Parse a php literal

ยงExample

use php_literal_parser::{from_str, Value, Key};

let map = from_str::<Value>(r#"["foo" => true, "nested" => ['foo' => false]]"#)?;

assert_eq!(map["foo"], true);
assert_eq!(map["nested"]["foo"], false);