pub enum AnyRequest {
Pending(Request<Pending>),
Claimed(Request<Claimed>),
Processing(Request<Processing>),
Completed(Request<Completed>),
Failed(Request<Failed>),
Canceled(Request<Canceled>),
Superseded(Request<Superseded>),
}Expand description
Enum that can hold a request in any state.
This is used for storage and API responses where we need to handle requests uniformly regardless of their current state.
Variants§
Pending(Request<Pending>)
Claimed(Request<Claimed>)
Processing(Request<Processing>)
Completed(Request<Completed>)
Failed(Request<Failed>)
Canceled(Request<Canceled>)
Superseded(Request<Superseded>)
Implementations§
Source§impl AnyRequest
impl AnyRequest
Sourcepub fn data(&self) -> &RequestData
pub fn data(&self) -> &RequestData
Get the request data regardless of state.
Sourcepub fn is_pending(&self) -> bool
pub fn is_pending(&self) -> bool
Check if this request is in the Pending state.
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Check if this request is in a terminal state (Completed, Failed, Canceled, or Superseded).
Sourcepub fn as_pending(&self) -> Option<&Request<Pending>>
pub fn as_pending(&self) -> Option<&Request<Pending>>
Try to extract as a Pending request.
Sourcepub fn into_pending(self) -> Option<Request<Pending>>
pub fn into_pending(self) -> Option<Request<Pending>>
Try to take as a Pending request, consuming self.
Trait Implementations§
Source§impl Clone for AnyRequest
impl Clone for AnyRequest
Source§fn clone(&self) -> AnyRequest
fn clone(&self) -> AnyRequest
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 AnyRequest
impl Debug for AnyRequest
Source§impl From<Request<Processing>> for AnyRequest
impl From<Request<Processing>> for AnyRequest
Source§fn from(r: Request<Processing>) -> Self
fn from(r: Request<Processing>) -> Self
Converts to this type from the input type.
Source§impl From<Request<Superseded>> for AnyRequest
impl From<Request<Superseded>> for AnyRequest
Source§fn from(r: Request<Superseded>) -> Self
fn from(r: Request<Superseded>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for AnyRequest
impl !RefUnwindSafe for AnyRequest
impl Send for AnyRequest
impl Sync for AnyRequest
impl Unpin for AnyRequest
impl !UnwindSafe for AnyRequest
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,
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