pub struct TestLoopSender<A>where
A: 'static,{ /* private fields */ }Expand description
TestLoopSender implements the CanSend methods for an actor that can Handle them.
ⓘ
let actor = TestActor::new();
let adapter = LateBoundSender::new();
let sender: TestLoopSender<TestActor> = data.register_actor(actor, Some(adapter));
// We can now send messages to the actor using the sender and adapter.
sender.send(TestMessage {});
adapter.send(TestMessage {});For the purposes of testloop, we keep a copy of the delay sender that is used to schedule callbacks on the testloop to execute either the actor.handle() function or the DelayedActionRunner.run_later_boxed() function.
Implementations§
Source§impl<A> TestLoopSender<A>where
A: Actor + 'static,
impl<A> TestLoopSender<A>where
A: Actor + 'static,
Sourcepub fn with_delay(self, delay: Duration) -> Self
pub fn with_delay(self, delay: Duration) -> Self
Returns a new TestLoopSender which sends messages with the given delay.
pub fn actor_handle(&self) -> TestLoopDataHandle<A>
Trait Implementations§
Source§impl<M, A> CanSend<M> for TestLoopSender<A>
impl<M, A> CanSend<M> for TestLoopSender<A>
Source§impl<M, R, A> CanSendAsync<M, R> for TestLoopSender<A>
impl<M, R, A> CanSendAsync<M, R> for TestLoopSender<A>
fn send_async(&self, msg: M) -> BoxFuture<'static, Result<R, AsyncSendError>>
Source§impl<A> Clone for TestLoopSender<A>
impl<A> Clone for TestLoopSender<A>
Source§impl<A> DelayedActionRunner<A> for TestLoopSender<A>where
A: 'static,
DelayedActionRunner that schedules the action to be run later by the TestLoop event loop.
impl<A> DelayedActionRunner<A> for TestLoopSender<A>where
A: 'static,
DelayedActionRunner that schedules the action to be run later by the TestLoop event loop.
fn run_later_boxed( &mut self, name: &str, dur: Duration, f: Box<dyn FnOnce(&mut A, &mut dyn DelayedActionRunner<A>) + Send + 'static>, )
Auto Trait Implementations§
impl<A> Freeze for TestLoopSender<A>
impl<A> !RefUnwindSafe for TestLoopSender<A>
impl<A> Send for TestLoopSender<A>
impl<A> Sync for TestLoopSender<A>
impl<A> Unpin for TestLoopSender<A>
impl<A> !UnwindSafe for TestLoopSender<A>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, Runner> DelayedActionRunnerExt<T> for Runnerwhere
Runner: DelayedActionRunner<T>,
impl<T, Runner> DelayedActionRunnerExt<T> for Runnerwhere
Runner: DelayedActionRunner<T>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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<M, R, T> IntoAsyncSender<M, R> for Twhere
R: Send + 'static,
T: CanSendAsync<M, R>,
impl<M, R, T> IntoAsyncSender<M, R> for Twhere
R: Send + 'static,
T: CanSendAsync<M, R>,
Source§fn into_async_sender(self) -> AsyncSender<M, R>
fn into_async_sender(self) -> AsyncSender<M, R>
Convert an owned implementer into an
AsyncSender.Source§fn as_async_sender(self: &Arc<T>) -> AsyncSender<M, R>
fn as_async_sender(self: &Arc<T>) -> AsyncSender<M, R>
Convert a reference-counted implementer into an
AsyncSender.Source§impl<A, B> IntoMultiSender<B> for Awhere
B: MultiSenderFrom<A>,
impl<A, B> IntoMultiSender<B> for Awhere
B: MultiSenderFrom<A>,
fn as_multi_sender(self: &Arc<A>) -> B
fn into_multi_sender(self) -> B
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request