pub struct Path { /* private fields */ }Expand description
A root plus typed segments, parsed once. A segment is a key on an object
(one leading # stripped) and an index on an array (the raw segment parsed
as usize, up to MAX_ARRAY_INDEX; a larger number is a key), resolved
at parse.
Debug prints the dotted text, Path("metadata.errors").
Implementations§
Source§impl Path
impl Path
Sourcepub fn get<'v>(&self, context: &'v OwnedDataValue) -> Option<&'v OwnedDataValue>
pub fn get<'v>(&self, context: &'v OwnedDataValue) -> Option<&'v OwnedDataValue>
The value at the path in context, an object holding the three roots.
Sourcepub fn set(
&self,
context: &mut OwnedDataValue,
value: OwnedDataValue,
) -> Result<()>
pub fn set( &self, context: &mut OwnedDataValue, value: OwnedDataValue, ) -> Result<()>
Assigns value at the path. At a root it replaces the root and accepts
only an object. A hop that cannot continue writes nothing and is Ok.
Sourcepub fn remove(
&self,
context: &mut OwnedDataValue,
) -> Result<Option<OwnedDataValue>>
pub fn remove( &self, context: &mut OwnedDataValue, ) -> Result<Option<OwnedDataValue>>
Removes the value at the path and returns it. A root cannot be removed.
Trait Implementations§
impl Eq for Path
impl StructuralPartialEq for Path
Auto Trait Implementations§
impl Freeze for Path
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnsafeUnpin for Path
impl UnwindSafe for Path
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.