pub enum ActionResult {
Success {
exports: HashMap<String, Value>,
},
NeedClarification {
question: String,
},
NeedApproval {
request: ApprovalRequest,
},
RetryableError {
message: String,
retry_after: Option<Duration>,
attempt: u32,
},
Error {
message: String,
},
}Expand description
Action execution result with retry semantics
Variants§
Success
Execution succeeded exports can be empty (side-effect only)
NeedClarification
Need user clarification to proceed
NeedApproval
Need explicit user approval before continuing
Fields
§
request: ApprovalRequestRetryableError
Retryable error (rate limit / timeout / external service flakiness)
Fields
Error
Non-recoverable error
Implementations§
Source§impl ActionResult
impl ActionResult
Sourcepub fn success() -> ActionResult
pub fn success() -> ActionResult
Convenience: create a success result with no exports
Sourcepub fn success_with(exports: HashMap<String, Value>) -> ActionResult
pub fn success_with(exports: HashMap<String, Value>) -> ActionResult
Convenience: create a success result with exports
Sourcepub fn success_with_one(key: impl Into<String>, value: Value) -> ActionResult
pub fn success_with_one(key: impl Into<String>, value: Value) -> ActionResult
Convenience: create a success result with a single export
Sourcepub fn need_clarification(question: impl Into<String>) -> ActionResult
pub fn need_clarification(question: impl Into<String>) -> ActionResult
Convenience: create a clarification request
Sourcepub fn need_approval(
reason: impl Into<String>,
command: Option<String>,
) -> ActionResult
pub fn need_approval( reason: impl Into<String>, command: Option<String>, ) -> ActionResult
Convenience: create an approval request
Sourcepub fn retryable(
message: impl Into<String>,
retry_after: Option<Duration>,
attempt: u32,
) -> ActionResult
pub fn retryable( message: impl Into<String>, retry_after: Option<Duration>, attempt: u32, ) -> ActionResult
Convenience: create a retryable error
Sourcepub fn error(message: impl Into<String>) -> ActionResult
pub fn error(message: impl Into<String>) -> ActionResult
Convenience: create a non-recoverable error
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if the result is successful
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if the result is retryable
Sourcepub fn needs_user_input(&self) -> bool
pub fn needs_user_input(&self) -> bool
Check if the result needs user input
Trait Implementations§
Source§impl Clone for ActionResult
impl Clone for ActionResult
Source§fn clone(&self) -> ActionResult
fn clone(&self) -> ActionResult
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ActionResult
impl Debug for ActionResult
Source§impl<'de> Deserialize<'de> for ActionResult
impl<'de> Deserialize<'de> for ActionResult
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ActionResult, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ActionResult, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ActionResult
impl Serialize for ActionResult
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ActionResult
impl RefUnwindSafe for ActionResult
impl Send for ActionResult
impl Sync for ActionResult
impl Unpin for ActionResult
impl UnsafeUnpin for ActionResult
impl UnwindSafe for ActionResult
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more