pub enum PathError {
Empty,
BadSegment(String),
DescendScalar(String),
IndexOutOfBounds {
index: usize,
len: usize,
at: String,
},
KeyOnSequence {
key: String,
at: String,
},
IndexOnMapping {
index: usize,
at: String,
},
}Expand description
Failure cases for parse_path and the apply helpers. Each variant
carries a short, user-facing message so the CLI can render the same
diagnostic across get/set/delete without reformatting.
Variants§
Empty
Empty input — pakx manifest get "" and friends.
BadSegment(String)
Malformed bracket syntax: missing closer, non-numeric body, or
the bracket opening before a key segment (e.g. [0].name is
allowed and means “index into the top-level sequence”, but the
top-level is always a mapping in agents.yml so this is
still rejected at the apply layer rather than the parser).
DescendScalar(String)
Caller asked to descend through a scalar (description.foo).
The set/delete paths can’t intuit what to overwrite, so we bail
rather than silently clobbering.
IndexOutOfBounds
Index out of bounds for the sequence at this point in the path. Surfaced for get/delete; set may extend a sequence by exactly one (push-on-end) and only raises this for any further gap.
KeyOnSequence
A key segment was applied to a sequence (skills.0 instead of
skills[0]). Surfaced explicitly so the user knows to use
bracket syntax for indexing rather than guessing.
IndexOnMapping
An index segment was applied to a mapping. Mirror of
KeyOnSequence for the opposite mismatch.
Trait Implementations§
Source§impl Error for PathError
impl Error for PathError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
impl Eq for PathError
impl StructuralPartialEq for PathError
Auto Trait Implementations§
impl Freeze for PathError
impl RefUnwindSafe for PathError
impl Send for PathError
impl Sync for PathError
impl Unpin for PathError
impl UnsafeUnpin for PathError
impl UnwindSafe for PathError
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> 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.