pub struct Job<TKey, TMsg>{
pub key: TKey,
pub msg: TMsg,
pub options: JobOptions,
pub accepted: Option<RpcReplyPort<Option<Job<TKey, TMsg>>>>,
}Expand description
Represents a job sent to a factory
Depending on the super::Factory’s routing scheme the
Job’s key is utilized to dispatch the job to specific
workers.
Fields§
§key: TKeyThe key of the job
msg: TMsgThe message of the job
options: JobOptionsThe job’s options, mainly related to timing information of the job
Default = JobOptions::default()
accepted: Option<RpcReplyPort<Option<Job<TKey, TMsg>>>>If provided, this channel can be used to block pushes into the factory until the factory can “accept” the message into its internal processing. This can be used to synchronize external threadpools to the Tokio processing pool and prevent overloading the unbounded channel which fronts all actors.
The reply channel return None if the job was accepted, or
[Some(Job)] if it was rejected & loadshed, and then the
job may be retried by the caller at a later time (if desired).
Default = None
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<TKey, TMsg> Freeze for Job<TKey, TMsg>
impl<TKey, TMsg> !RefUnwindSafe for Job<TKey, TMsg>
impl<TKey, TMsg> Send for Job<TKey, TMsg>
impl<TKey, TMsg> Sync for Job<TKey, TMsg>where
TMsg: Sync,
impl<TKey, TMsg> Unpin for Job<TKey, TMsg>
impl<TKey, TMsg> !UnwindSafe for Job<TKey, TMsg>
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
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>
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>
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