pub struct PathInfo {
pub path: String,
pub path_type: Option<String>,
pub value: Option<Value>,
}Expand description
Information about a path in a JSON structure.
Used by JpxEngine::paths to enumerate all paths in a JSON document.
§Example
use jpx_engine::JpxEngine;
let engine = JpxEngine::new();
let paths = engine.paths(r#"{"user": {"name": "alice"}}"#, true, false).unwrap();
for path in paths {
println!("{}: {:?}", path.path, path.path_type);
}
// Output:
// @: Some("object")
// user: Some("object")
// user.name: Some("string")Fields§
§path: StringPath in dot notation (e.g., “user.name”, “items.0.id”)
path_type: Option<String>JSON type at this path (if include_types was true)
value: Option<Value>Value at this path (if include_values was true, leaf nodes only)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PathInfo
impl<'de> Deserialize<'de> for PathInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PathInfo
impl RefUnwindSafe for PathInfo
impl Send for PathInfo
impl Sync for PathInfo
impl Unpin for PathInfo
impl UnwindSafe for PathInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more