pub struct ApprovalRouter { /* private fields */ }Expand description
Routes approval requests to one replaceable caller handler.
Implementations§
Source§impl ApprovalRouter
impl ApprovalRouter
Sourcepub fn new() -> Self
pub fn new() -> Self
A router with no handler yet: Self::route answers Ok(None).
Sourcepub fn on_approval<Handler, HandlerFuture>(&mut self, handler: Handler)where
Handler: Fn(ApprovalRequestParams) -> HandlerFuture + Send + Sync + 'static,
HandlerFuture: Future<Output = ApprovalDecisionInput> + Send + 'static,
pub fn on_approval<Handler, HandlerFuture>(&mut self, handler: Handler)where
Handler: Fn(ApprovalRequestParams) -> HandlerFuture + Send + Sync + 'static,
HandlerFuture: Future<Output = ApprovalDecisionInput> + Send + 'static,
Replaces the current handler. One request must never race two answers.
Sourcepub async fn route(
&self,
request: &ApprovalRequestParams,
) -> Result<Option<ApprovalDecisionInput>, ApprovalRoutingError>
pub async fn route( &self, request: &ApprovalRequestParams, ) -> Result<Option<ApprovalDecisionInput>, ApprovalRoutingError>
Returns a validated caller decision, or None when no handler is registered.
The session then sends the server-offered Denied choice, else the offered
Abort choice, or fails only that turn when neither is offered.
Trait Implementations§
Source§impl Clone for ApprovalRouter
impl Clone for ApprovalRouter
Auto Trait Implementations§
impl !RefUnwindSafe for ApprovalRouter
impl !UnwindSafe for ApprovalRouter
impl Forget for ApprovalRouter
impl Freeze for ApprovalRouter
impl Move for ApprovalRouter
impl Send for ApprovalRouter
impl Sync for ApprovalRouter
impl Unpin for ApprovalRouter
impl UnsafeUnpin for ApprovalRouter
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