pub struct ApprovalQueue { /* private fields */ }Implementations§
Source§impl ApprovalQueue
impl ApprovalQueue
pub fn new(max_pending: usize, default_timeout: Duration) -> Self
pub fn on_push<F>(self, f: F) -> Self
pub fn on_resolve<F>(self, f: F) -> Self
pub fn size(&self) -> usize
pub fn list(&self) -> Vec<ApprovalRequest>
Sourcepub async fn push(
&self,
request: ApprovalRequest,
) -> Result<ApprovalResult, ApprovalError>
pub async fn push( &self, request: ApprovalRequest, ) -> Result<ApprovalResult, ApprovalError>
Enqueue a request and await a decision. Resolves with Deny if the default timeout elapses first.
Sourcepub fn respond(
&self,
request_id: &str,
decision: ApprovalDecision,
note: Option<String>,
) -> bool
pub fn respond( &self, request_id: &str, decision: ApprovalDecision, note: Option<String>, ) -> bool
Resolve a pending request. Returns true if a matching request was found and resolved.
Sourcepub fn drain_deny(&self, reason: &str)
pub fn drain_deny(&self, reason: &str)
Cancel every outstanding approval with Deny + reason.
Auto Trait Implementations§
impl !RefUnwindSafe for ApprovalQueue
impl !UnwindSafe for ApprovalQueue
impl Freeze for ApprovalQueue
impl Send for ApprovalQueue
impl Sync for ApprovalQueue
impl Unpin for ApprovalQueue
impl UnsafeUnpin for ApprovalQueue
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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