pub struct IdempotencyPath { /* private fields */ }Expand description
A field path into a call’s input, naming the value that identifies the operation.
Parsed once, at agent-build time, so a malformed declaration fails before a run rather than during one. See the module docs for the key format and the refusal rule.
Implementations§
Source§impl IdempotencyPath
impl IdempotencyPath
Sourcepub fn parse(path: &str) -> Result<Self, IdempotencyPathError>
pub fn parse(path: &str) -> Result<Self, IdempotencyPathError>
Parses a dotted field path.
"claim_id" is one segment; "payment.claim_id" is two, walked as
object lookups in order. There is no array indexing and no escaping: a
field whose name contains a dot cannot be named, which is a limit worth
having while the syntax is one character wide.
§Errors
IdempotencyPathError::Empty for an empty path, and
IdempotencyPathError::EmptySegment for a path with an empty
segment ("a.", ".a", "a..b"). Both are typos, and a typo in the
declaration that names a payment must not survive to a run.
Sourcepub fn derive(&self, tool: &str, input: &Value) -> Result<String, ToolError>
pub fn derive(&self, tool: &str, input: &Value) -> Result<String, ToolError>
Derives the key for one call, or refuses the call.
Returns <tool>:<value> where value is the non-empty string or the
number at this path in input.
§Errors
ToolError::MissingIdempotencyKey when the path is absent, runs
through a non-object, or lands on anything but a non-empty string or a
number. A boolean, a null, an object, an array, and an empty string are
all refused: none of them names one operation, and a key that does not
name one operation is worse than no key at all, because it looks like an
identity while being a collision. The message names the tool, the path,
and the keys the input actually carries.
Trait Implementations§
Source§impl Clone for IdempotencyPath
impl Clone for IdempotencyPath
Source§fn clone(&self) -> IdempotencyPath
fn clone(&self) -> IdempotencyPath
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IdempotencyPath
impl Debug for IdempotencyPath
impl Eq for IdempotencyPath
Source§impl PartialEq for IdempotencyPath
impl PartialEq for IdempotencyPath
impl StructuralPartialEq for IdempotencyPath
Auto Trait Implementations§
impl Freeze for IdempotencyPath
impl RefUnwindSafe for IdempotencyPath
impl Send for IdempotencyPath
impl Sync for IdempotencyPath
impl Unpin for IdempotencyPath
impl UnsafeUnpin for IdempotencyPath
impl UnwindSafe for IdempotencyPath
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.