pub struct Extension<T>(pub T);
Expand description
A Specialized extractor for the Extensions
of the current JobCall
.
Any type that is stored in the Extensions
of the current JobCall
can be extracted using this extractor.
For Optional extraction, you can use this extractor with Option<Extension<T>>
where T
is the type you want to extract.
Tuple Fields§
§0: T
Trait Implementations§
Source§impl<Ctx, T> FromJobCallParts<Ctx> for Extension<T>
impl<Ctx, T> FromJobCallParts<Ctx> for Extension<T>
Source§type Rejection = ExtensionNotFound
type Rejection = ExtensionNotFound
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a job result.
Source§async fn from_job_call_parts(
parts: &mut JobCallParts,
_: &Ctx,
) -> Result<Self, Self::Rejection>
async fn from_job_call_parts( parts: &mut JobCallParts, _: &Ctx, ) -> Result<Self, Self::Rejection>
Perform the extraction.
Source§impl<Ctx, T> OptionalFromJobCallParts<Ctx> for Extension<T>
impl<Ctx, T> OptionalFromJobCallParts<Ctx> for Extension<T>
Source§type Rejection = Infallible
type Rejection = Infallible
If the extractor fails, it will use this “rejection” type. Read more
Source§async fn from_job_call_parts(
parts: &mut JobCallParts,
_: &Ctx,
) -> Result<Option<Self>, Self::Rejection>
async fn from_job_call_parts( parts: &mut JobCallParts, _: &Ctx, ) -> Result<Option<Self>, Self::Rejection>
Perform the extraction.
Auto Trait Implementations§
impl<T> Freeze for Extension<T>where
T: Freeze,
impl<T> RefUnwindSafe for Extension<T>where
T: RefUnwindSafe,
impl<T> Send for Extension<T>where
T: Send,
impl<T> Sync for Extension<T>where
T: Sync,
impl<T> Unpin for Extension<T>where
T: Unpin,
impl<T> UnwindSafe for Extension<T>where
T: UnwindSafe,
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