[−][src]Struct sealrs::testkit::actors::test_probe::TestProbe
Methods
impl TestProbe
[src]
pub fn new(system: TSafe<TestLocalActorSystem>, name: Option<&str>) -> TestProbe
[src]
Initialize new probe. This is internal construct, do not try use it directly
pub fn aref(&mut self) -> ActorRef
[src]
Return internal actor reference
pub fn set_timeout(&mut self, timeout: Duration)
[src]
Set default expects timeout
pub fn send(&mut self, target: &mut ActorRef, msg: Message)
[src]
Send message to some actor
pub fn reply(&mut self, msg: Message)
[src]
Reply to the last sender with specified message
pub fn expect_msg(
&mut self,
matcher: Box<dyn Fn(Message) -> bool + Send>
) -> Message
[src]
&mut self,
matcher: Box<dyn Fn(Message) -> bool + Send>
) -> Message
Expect a single message from an actor. Blocks called thread while message will be received or timeout was reached. Returns intercepted message instance.
Example
probe.expect_msg(type_matcher!(some_actor::SomeMsg)); let msg = probe.expect_msg(type_matcher!(some_actor::SomeMsgOther));
pub fn expect_msg_any_of(
&mut self,
matchers: Vec<Box<dyn Fn(Message) -> bool + Send>>
) -> Message
[src]
&mut self,
matchers: Vec<Box<dyn Fn(Message) -> bool + Send>>
) -> Message
Expect an any message in the specified set from an actor. Blocks called thread while message will be received or timeout was reached. Returns intercepted messages list.
Example
probe.expect_msg_any_of( vec![ type_matcher!(some_actor::SomeMsg0)), type_matcher!(some_actor::SomeMsg1)), type_matcher!(some_actor::SomeMsg2)) ] );
pub fn expect_msg_all_of(
&mut self,
matchers: Vec<Box<dyn Fn(Message) -> bool + Send>>
) -> Vec<Message>
[src]
&mut self,
matchers: Vec<Box<dyn Fn(Message) -> bool + Send>>
) -> Vec<Message>
Expect all messages in specified set from an actor. Order of messages is not not significant. Target message may be altered with some other messages. Test will passed, when all messages from the list, will be intercepted from input messages stream. Blocks called thread while message will be received or timeout was reached. Returns intercepted messages list.
Example
probe.expect_msg_all_of( vec![ type_matcher!(some_actor::SomeMsg0)), type_matcher!(some_actor::SomeMsg1)), type_matcher!(some_actor::SomeMsg2)) ] );
pub fn expect_no_msg(&mut self, duration: Duration)
[src]
Expect than no one actor do not send message to this probe in specified time duration
Example
probe.expect_no_msg(Duration::from_secs(1));
pub fn expect_terminated(&mut self, target: &ActorRef)
[src]
Expect termination of the target. Probe must be watch it before cull this expector.
Example
probe.watch(&target); // Some other code probe.expect_terminated(&target);
pub fn watch(&mut self, target: &ActorRef)
[src]
Subscribe probe fot watching events of target
pub fn get_last_sender(&self) -> MutexGuard<ActorRef>
[src]
Returns the sender of the last received message.
pub fn stop(&mut self)
[src]
Stops the probe inner actor
Trait Implementations
Auto Trait Implementations
impl !Sync for TestProbe
impl Unpin for TestProbe
impl Send for TestProbe
impl !UnwindSafe for TestProbe
impl !RefUnwindSafe for TestProbe
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,