pub struct TestProbe<M: Send + 'static> { /* private fields */ }Implementations§
Source§impl<M: Send + 'static> TestProbe<M>
impl<M: Send + 'static> TestProbe<M>
pub fn new(name: &str) -> Self
pub fn actor_ref(&self) -> &ActorRef<M>
Sourcepub async fn expect_msg(
&mut self,
timeout: Duration,
) -> Result<M, TestProbeError>
pub async fn expect_msg( &mut self, timeout: Duration, ) -> Result<M, TestProbeError>
Wait for a single message.
Sourcepub async fn expect_msg_pf<F>(
&mut self,
timeout: Duration,
pred: F,
) -> Result<M, TestProbeError>
pub async fn expect_msg_pf<F>( &mut self, timeout: Duration, pred: F, ) -> Result<M, TestProbeError>
Wait for a message that matches the given predicate.
Sourcepub async fn expect_no_msg(
&mut self,
timeout: Duration,
) -> Result<(), TestProbeError>
pub async fn expect_no_msg( &mut self, timeout: Duration, ) -> Result<(), TestProbeError>
Assert that no message arrives within the given timeout.
Sourcepub async fn expect_msg_class<T, F>(
&mut self,
timeout: Duration,
extract: F,
) -> Result<T, TestProbeError>
pub async fn expect_msg_class<T, F>( &mut self, timeout: Duration, extract: F, ) -> Result<T, TestProbeError>
Wait for a message and assert it matches the variant returned
by extract.where T selects
a sub-variant of the message enum. The extract closure
returns Some(payload) for the desired variant.
Sourcepub async fn receive_n(
&mut self,
n: usize,
timeout: Duration,
) -> Result<Vec<M>, TestProbeError>
pub async fn receive_n( &mut self, n: usize, timeout: Duration, ) -> Result<Vec<M>, TestProbeError>
Receive exactly n messages or return TestProbeError::Timeout
if timeout elapses before they all arrive.
Sourcepub async fn receive_while<F>(
&mut self,
timeout: Duration,
pred: F,
) -> Result<Vec<M>, TestProbeError>
pub async fn receive_while<F>( &mut self, timeout: Duration, pred: F, ) -> Result<Vec<M>, TestProbeError>
Receive messages while pred returns true, stopping at the
first message for which pred returns false (that message is
discarded).
Sourcepub async fn fish_for_message<F>(
&mut self,
timeout: Duration,
pred: F,
) -> Result<M, TestProbeError>
pub async fn fish_for_message<F>( &mut self, timeout: Duration, pred: F, ) -> Result<M, TestProbeError>
Drain messages until one matches pred. Discards mismatches.
Sourcepub async fn expect_all_of(
&mut self,
timeout: Duration,
expected: Vec<M>,
) -> Result<(), TestProbeError>
pub async fn expect_all_of( &mut self, timeout: Duration, expected: Vec<M>, ) -> Result<(), TestProbeError>
Receive expected.len() messages and assert that the multi-set
of received messages equals expected (order-insensitive).
Sourcepub async fn expect_msg_eq(
&mut self,
timeout: Duration,
expected: M,
) -> Result<M, TestProbeError>
pub async fn expect_msg_eq( &mut self, timeout: Duration, expected: M, ) -> Result<M, TestProbeError>
Wait for a message and assert it equals expected.
ExpectMsg<T>(T expected).
Sourcepub async fn expect_msg_all_of_in_order(
&mut self,
timeout: Duration,
expected: Vec<M>,
) -> Result<(), TestProbeError>
pub async fn expect_msg_all_of_in_order( &mut self, timeout: Duration, expected: Vec<M>, ) -> Result<(), TestProbeError>
Receive n messages, asserting they appear in the exact order
of expected.with sequential
matching semantics.