pub struct JobHandle<J = (), C = Channel> { /* private fields */ }Expand description
A handle to a single job.
The handle also caches the details of the job, so that they can be accessed without making a network request.
Implementations§
Source§impl<J, C> JobHandle<J, C>where
C: GrpcService<BoxBody> + Clone,
C::Error: Into<StdError>,
C::ResponseBody: Body<Data = Bytes> + Send + 'static,
<C::ResponseBody as Body>::Error: Into<StdError> + Send,
impl<J, C> JobHandle<J, C>where
C: GrpcService<BoxBody> + Clone,
C::Error: Into<StdError>,
C::ResponseBody: Body<Data = Bytes> + Send + 'static,
<C::ResponseBody as Body>::Error: Into<StdError> + Send,
Sourcepub async fn details(&self) -> Result<Arc<JobDetails>>
pub async fn details(&self) -> Result<Arc<JobDetails>>
Get the details of the job.
Sourcepub fn details_cached(&self) -> Option<Arc<JobDetails>>
pub fn details_cached(&self) -> Option<Arc<JobDetails>>
Get the cached details of the job, if available.
This is useful for getting the details of a job without making a network request.
Sourcepub fn cast_type<T: JobType>(&self) -> JobHandle<T, C>
pub fn cast_type<T: JobType>(&self) -> JobHandle<T, C>
Cast the job handle to a specific job type.
This does not perform any runtime checks, so it is up to the caller to ensure that the job type is correct.
Sourcepub fn cast_unknown(&self) -> JobHandle<(), C>
pub fn cast_unknown(&self) -> JobHandle<(), C>
Cast the job handle to an unknown job type.
Source§impl<J, C> JobHandle<J, C>where
J: JobType,
C: GrpcService<BoxBody> + Clone,
C::Error: Into<StdError>,
C::ResponseBody: Body<Data = Bytes> + Send + 'static,
<C::ResponseBody as Body>::Error: Into<StdError> + Send,
impl<J, C> JobHandle<J, C>where
J: JobType,
C: GrpcService<BoxBody> + Clone,
C::Error: Into<StdError>,
C::ResponseBody: Body<Data = Bytes> + Send + 'static,
<C::ResponseBody as Body>::Error: Into<StdError> + Send,
Sourcepub async fn wait_with_interval(&self, interval: Duration) -> Result<J::Output>
pub async fn wait_with_interval(&self, interval: Duration) -> Result<J::Output>
Retrieve the output of the job with a given polling interval.
Trait Implementations§
Source§impl<J, C> IntoFuture for JobHandle<J, C>
impl<J, C> IntoFuture for JobHandle<J, C>
Source§type Output = Result<<J as JobType>::Output, Report>
type Output = Result<<J as JobType>::Output, Report>
The output that the future will produce on completion.
Source§type IntoFuture = Pin<Box<dyn Future<Output = <JobHandle<J, C> as IntoFuture>::Output> + Send>>
type IntoFuture = Pin<Box<dyn Future<Output = <JobHandle<J, C> as IntoFuture>::Output> + Send>>
Which kind of future are we turning this into?
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Creates a future from a value. Read more
Auto Trait Implementations§
impl<J = (), C = Channel> !Freeze for JobHandle<J, C>
impl<J = (), C = Channel> !RefUnwindSafe for JobHandle<J, C>
impl<J, C> Send for JobHandle<J, C>
impl<J, C> Sync for JobHandle<J, C>
impl<J, C> Unpin for JobHandle<J, C>
impl<J = (), C = Channel> !UnwindSafe for JobHandle<J, C>
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<W> IntoExecutionHandler for W
impl<W> IntoExecutionHandler for W
Source§fn handler<J>(self) -> Arc<dyn ExecutionHandlerRaw + Send + Sync>where
Self: ExecutionHandler<J>,
J: JobType,
fn handler<J>(self) -> Arc<dyn ExecutionHandlerRaw + Send + Sync>where
Self: ExecutionHandler<J>,
J: JobType,
Convert
self into a [RawHandler] that can be registered
in workers.Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request