pub struct ActorPool<M: Send + Clone + 'static, R: Send + 'static> { /* private fields */ }Expand description
Connection pool using actor model
Implementations§
Source§impl<M: Send + Clone + 'static, R: Send + 'static> ActorPool<M, R>
impl<M: Send + Clone + 'static, R: Send + 'static> ActorPool<M, R>
Sourcepub fn new<F, H>(size: usize, factory: F, mailbox_size: usize) -> Self
pub fn new<F, H>(size: usize, factory: F, mailbox_size: usize) -> Self
Create a new pool with the given factory
Sourcepub fn ask(&self, message: M) -> Result<R, ActorError>
pub fn ask(&self, message: M) -> Result<R, ActorError>
Send a message using round-robin selection
Sourcepub fn ask_actor(&self, actor_idx: usize, message: M) -> Result<R, ActorError>
pub fn ask_actor(&self, actor_idx: usize, message: M) -> Result<R, ActorError>
Send to a specific actor
Sourcepub fn broadcast(&self, message: M) -> Vec<Result<R, ActorError>>
pub fn broadcast(&self, message: M) -> Vec<Result<R, ActorError>>
Broadcast to all actors
Trait Implementations§
Auto Trait Implementations§
impl<M, R> !Freeze for ActorPool<M, R>
impl<M, R> !RefUnwindSafe for ActorPool<M, R>
impl<M, R> Send for ActorPool<M, R>
impl<M, R> Sync for ActorPool<M, R>
impl<M, R> Unpin for ActorPool<M, R>where
R: Unpin,
impl<M, R> UnsafeUnpin for ActorPool<M, R>
impl<M, R> !UnwindSafe for ActorPool<M, R>
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