pub struct PendingApproval {
pub request: ApprovalRequest,
}Expand description
Handle for a pending approval interrupt.
Wraps an ApprovalRequest and provides ergonomic resolution methods
so callers can resolve the interrupt directly instead of searching for
the matching method on LoopDriver.
§Example
match driver.next().await? {
LoopStep::Interrupt(LoopInterrupt::ApprovalRequest(pending)) => {
println!("Needs approval: {}", pending.request.summary);
pending.approve(driver)?;
}
_ => {}
}Fields§
§request: ApprovalRequestThe underlying approval request details.
Implementations§
Source§impl PendingApproval
impl PendingApproval
Sourcepub fn approve<S: ModelSession>(
self,
driver: &mut LoopDriver<S>,
) -> Result<(), LoopError>
pub fn approve<S: ModelSession>( self, driver: &mut LoopDriver<S>, ) -> Result<(), LoopError>
Approve the pending tool call.
Sourcepub fn deny<S: ModelSession>(
self,
driver: &mut LoopDriver<S>,
) -> Result<(), LoopError>
pub fn deny<S: ModelSession>( self, driver: &mut LoopDriver<S>, ) -> Result<(), LoopError>
Deny the pending tool call.
Sourcepub fn deny_with_reason<S: ModelSession>(
self,
driver: &mut LoopDriver<S>,
reason: impl Into<String>,
) -> Result<(), LoopError>
pub fn deny_with_reason<S: ModelSession>( self, driver: &mut LoopDriver<S>, reason: impl Into<String>, ) -> Result<(), LoopError>
Deny the pending tool call with a reason.
Trait Implementations§
Source§impl Clone for PendingApproval
impl Clone for PendingApproval
Source§fn clone(&self) -> PendingApproval
fn clone(&self) -> PendingApproval
Returns a duplicate of the value. Read more
1.0.0 · 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 PendingApproval
impl Debug for PendingApproval
Source§impl Deref for PendingApproval
impl Deref for PendingApproval
Source§type Target = ApprovalRequest
type Target = ApprovalRequest
The resulting type after dereferencing.
Source§fn deref(&self) -> &ApprovalRequest
fn deref(&self) -> &ApprovalRequest
Dereferences the value.
Source§impl<'de> Deserialize<'de> for PendingApproval
impl<'de> Deserialize<'de> for PendingApproval
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for PendingApproval
impl PartialEq for PendingApproval
Source§impl Serialize for PendingApproval
impl Serialize for PendingApproval
impl Eq for PendingApproval
impl StructuralPartialEq for PendingApproval
Auto Trait Implementations§
impl Freeze for PendingApproval
impl RefUnwindSafe for PendingApproval
impl Send for PendingApproval
impl Sync for PendingApproval
impl Unpin for PendingApproval
impl UnsafeUnpin for PendingApproval
impl UnwindSafe for PendingApproval
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