pub struct RefPath { /* private fields */ }Expand description
A parsed path: dotted keys plus bracket array indices, a.b[2].c.
The one spelling over Seg. References parse it directly; --set’s
path parses it too, and its write-side caller then runs
try_into_keys, which rejects any
Index step — reading an array element has one obvious
meaning, writing one does not. Empty paths and empty segments are
unrepresentable: both from_str and
from_keys reject them.
Display is render_path. Not injective with respect to document keys:
a key literally spelled a[0] exists, but this grammar reads it as a key
and an index — the same accepted loss as keys containing a literal dot.
Implementations§
Source§impl RefPath
impl RefPath
Sourcepub fn from_keys(keys: Vec<String>) -> Result<Self, PathError>
pub fn from_keys(keys: Vec<String>) -> Result<Self, PathError>
Build from key strings. Rejects an empty path or any empty segment.
Sourcepub fn try_into_keys(self) -> Result<Vec<String>, PathError>
pub fn try_into_keys(self) -> Result<Vec<String>, PathError>
The owned key strings, checked all-key.
The one write-side predicate: a caller that assigns into a document
takes keys one per segment, so an Index step fails
here rather than at the merge — before any file is read, and with the
whole path rendered into the error.
Trait Implementations§
impl Eq for RefPath
Source§impl Ord for RefPath
impl Ord for RefPath
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for RefPath
impl PartialOrd for RefPath
impl StructuralPartialEq for RefPath
Auto Trait Implementations§
impl Freeze for RefPath
impl RefUnwindSafe for RefPath
impl Send for RefPath
impl Sync for RefPath
impl Unpin for RefPath
impl UnsafeUnpin for RefPath
impl UnwindSafe for RefPath
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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
key and return true if they are equal.