pub struct ActorTestBuilder<S: Send + 'static> { /* private fields */ }Expand description
This builder is used to build a TestActor.
Implementations§
Source§impl<S: Send + 'static> ActorTestBuilder<S>
impl<S: Send + 'static> ActorTestBuilder<S>
Sourcepub fn new(addr: Addr) -> Self
pub fn new(addr: Addr) -> Self
Creates a new ActorTestBuilder with some default settings which are needed to run tests.
Sourcepub fn check(self, check_fn: fn(&S) -> bool) -> Self
pub fn check(self, check_fn: fn(&S) -> bool) -> Self
Adds the given check function to the test list. check_fn can immutably access the whole internal state of the actor to be tested.
Sourcepub fn tell<M: Any + Send>(self, msg: M) -> Self
pub fn tell<M: Any + Send>(self, msg: M) -> Self
Sends the given message to the actor to be tested.
Sourcepub fn ask<M: Any + Send, R: Any + Send>(
self,
msg: M,
expected_response: Response<R>,
) -> Self
pub fn ask<M: Any + Send, R: Any + Send>( self, msg: M, expected_response: Response<R>, ) -> Self
Sourcepub fn expect_tell<M: Any + Send>(self, criteria: fn(M) -> bool) -> Self
pub fn expect_tell<M: Any + Send>(self, criteria: fn(M) -> bool) -> Self
This function defines that a tell-message is to be received next with the given condition. If no specific condition is required a simple |msg| true can be passed in.
Auto Trait Implementations§
impl<S> Freeze for ActorTestBuilder<S>
impl<S> !RefUnwindSafe for ActorTestBuilder<S>
impl<S> Send for ActorTestBuilder<S>
impl<S> !Sync for ActorTestBuilder<S>
impl<S> Unpin for ActorTestBuilder<S>
impl<S> !UnwindSafe for ActorTestBuilder<S>
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