Struct ntex_server::Worker
source · 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) -> Worker<T>where
T: Send + 'static,
F: ServerConfiguration<Item = T>,
pub fn start<F>(id: WorkerId, cfg: F) -> 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)