pub struct Worker<T> { /* private fields */ }
Expand description
Server worker
Worker accepts message via unbounded channel and starts processing.
Implementations§
Source§impl<T> Worker<T>
impl<T> Worker<T>
Sourcepub fn start<F>(id: WorkerId, cfg: F, cid: Option<CoreId>) -> Worker<T>where
T: Send + 'static,
F: ServerConfiguration<Item = T>,
pub fn start<F>(id: WorkerId, cfg: F, cid: Option<CoreId>) -> Worker<T>where
T: Send + 'static,
F: ServerConfiguration<Item = T>,
Start worker.
Sourcepub fn send(&self, msg: T) -> Result<(), T>
pub fn send(&self, msg: T) -> Result<(), T>
Send message to the worker.
Returns Ok
if message got accepted by the worker.
Otherwise return message back as Err
Sourcepub fn status(&self) -> WorkerStatus
pub fn status(&self) -> WorkerStatus
Check worker status.
Sourcepub async fn wait_for_status(&mut self) -> WorkerStatus
pub async fn wait_for_status(&mut self) -> WorkerStatus
Wait for worker status updates
Sourcepub fn stop(&self, timeout: Millis) -> WorkerStop ⓘ
pub fn stop(&self, timeout: Millis) -> WorkerStop ⓘ
Stop worker.
If timeout value is zero, force shutdown worker
Trait Implementations§
Source§impl<T> Ord for Worker<T>
impl<T> Ord for Worker<T>
Source§impl<T> PartialOrd for Worker<T>
impl<T> PartialOrd for Worker<T>
impl<T> Eq for Worker<T>
Auto Trait Implementations§
impl<T> Freeze for Worker<T>
impl<T> !RefUnwindSafe for Worker<T>
impl<T> Send for Worker<T>where
T: Send,
impl<T> Sync for Worker<T>where
T: Send,
impl<T> Unpin for Worker<T>
impl<T> !UnwindSafe for Worker<T>
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