pub struct WorkerPool<Req, Resp> {
pub policy: DispatchPolicy,
/* private fields */
}Expand description
Pool of workers. Generic over (Req, Resp); works with the
Worker trait directly.
Fields§
§policy: DispatchPolicyImplementations§
Source§impl<Req, Resp> WorkerPool<Req, Resp>
impl<Req, Resp> WorkerPool<Req, Resp>
pub fn new(policy: DispatchPolicy) -> Self
pub fn add(&mut self, worker: Arc<dyn Worker<Req, Resp>>)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn dispatch(&self, req: Req) -> Result<Resp, WorkerError>
pub fn dispatch(&self, req: Req) -> Result<Resp, WorkerError>
Dispatch a request through the chosen worker.
Sourcepub fn health(&self) -> Vec<(WorkerId, WorkerHealth)>
pub fn health(&self) -> Vec<(WorkerId, WorkerHealth)>
Snapshot of every worker’s health.
Auto Trait Implementations§
impl<Req, Resp> !Freeze for WorkerPool<Req, Resp>
impl<Req, Resp> !RefUnwindSafe for WorkerPool<Req, Resp>
impl<Req, Resp> Send for WorkerPool<Req, Resp>
impl<Req, Resp> Sync for WorkerPool<Req, Resp>
impl<Req, Resp> Unpin for WorkerPool<Req, Resp>
impl<Req, Resp> UnsafeUnpin for WorkerPool<Req, Resp>
impl<Req, Resp> !UnwindSafe for WorkerPool<Req, Resp>
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> 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