pub struct JobHandle<S> {
pub id: String,
pub stream: Receiver<S>,
/* private fields */
}Expand description
Handle to a running inference job thread.
Provides access to the output stream (stream) plus cancellation (cancel) and
a join method to retrieve the final result (or error) once the handler terminates.
Fields§
§id: String§stream: Receiver<S>Implementations§
Source§impl<S> JobHandle<S>
impl<S> JobHandle<S>
pub fn new( id: String, stream: Receiver<S>, cancel: CancelToken, join: JoinHandle<Result<(), InferenceError>>, ) -> Self
Sourcepub fn cancel(&self)
pub fn cancel(&self)
Cancel the running job. This will signal the job to stop processing as soon as possible.
Note that this does not immediately kill the thread, but rather requests it to stop.
The inference function has to use the CancelToken to check for cancellation.
Sourcepub fn join(self) -> Result<(), InferenceError>
pub fn join(self) -> Result<(), InferenceError>
Wait for the job to finish and return the result.
Auto Trait Implementations§
impl<S> Freeze for JobHandle<S>
impl<S> !RefUnwindSafe for JobHandle<S>
impl<S> Send for JobHandle<S>where
S: Send,
impl<S> Sync for JobHandle<S>where
S: Send,
impl<S> Unpin for JobHandle<S>where
S: Unpin,
impl<S> !UnwindSafe for JobHandle<S>
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> 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