pub struct JsonPath(/* private fields */);Expand description
A path into a JSON document.
Implementations§
Source§impl JsonPath
impl JsonPath
Sourcepub fn new(segments: Vec<PathSegment>) -> Self
pub fn new(segments: Vec<PathSegment>) -> Self
Create a path from segments.
Sourcepub fn parse(path: &str) -> Self
pub fn parse(path: &str) -> Self
Parse a path from dot notation (e.g., “user.name” or “items.0.value”).
Sourcepub fn segments(&self) -> &[PathSegment]
pub fn segments(&self) -> &[PathSegment]
Get the segments.
Sourcepub fn last(&self) -> Option<&PathSegment>
pub fn last(&self) -> Option<&PathSegment>
Get the last segment.
Sourcepub fn push(&mut self, segment: PathSegment)
pub fn push(&mut self, segment: PathSegment)
Append a segment.
Sourcepub fn child_index(&self, index: usize) -> Self
pub fn child_index(&self, index: usize) -> Self
Create a child path with an index.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for JsonPath
impl<'de> Deserialize<'de> for JsonPath
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
impl Eq for JsonPath
impl StructuralPartialEq for JsonPath
Auto Trait Implementations§
impl Freeze for JsonPath
impl RefUnwindSafe for JsonPath
impl Send for JsonPath
impl Sync for JsonPath
impl Unpin for JsonPath
impl UnwindSafe for JsonPath
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