Skip to main content

get_from_unchecked

Function get_from_unchecked 

Source
pub unsafe fn get_from_unchecked<'a, S, T, P>(src: S, path: P) -> T
where S: Source + 'a, T: Deserialize<'a>, P: IntoIterator, P::Item: JsonPointer,
Available on crate feature serde only.
Expand description

Skips to the given path and deserializes the specified type.

Similar to get_from, but without validation. This function’s behavior is undefined if any of the following conditions are not met:

  • The JSON must be valid.
  • The path must exist.
  • The specified type must be deserializable from the provided JSON data.

§Example

let src = r#"{"segfault?": 28526}"#;
let res: u16 = unsafe { flexon::get_from_unchecked(src, ["segfault?"]) };

assert_eq!(&res.to_le_bytes(), b"no");