Struct a2kit::JsonCursor
source · pub struct JsonCursor { /* private fields */ }Expand description
Cursor to walk a JSON tree.
Implementations§
source§impl JsonCursor
impl JsonCursor
pub fn new() -> Self
sourcepub fn next<'a>(
&mut self,
obj: &'a JsonValue
) -> Option<(String, &'a JsonValue)>
pub fn next<'a>( &mut self, obj: &'a JsonValue ) -> Option<(String, &'a JsonValue)>
Walk the tree of a JSON object finding all the leaves. Any value that is not an object is considered a leaf. This may be called recursively.
pub fn parent<'a>(&self, obj: &'a JsonValue) -> Option<&'a JsonValue>
sourcepub fn key_path(&self) -> Vec<String>
pub fn key_path(&self) -> Vec<String>
Return key to current leaf as list of strings.
Note this includes the key that is returned with next.
sourcepub fn key_path_string(&self) -> String
pub fn key_path_string(&self) -> String
Return key to current leaf as a path string.
This can have problems in case there are keys containing /,
so key_path should always be preferred.
Auto Trait Implementations§
impl RefUnwindSafe for JsonCursor
impl Send for JsonCursor
impl Sync for JsonCursor
impl Unpin for JsonCursor
impl UnwindSafe for JsonCursor
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