Skip to main content

Proxy

Struct Proxy 

Source
pub struct Proxy { /* private fields */ }
Expand description

A proxy for testing actors.

Implementations§

Source§

impl Proxy

Source

pub fn addr(&self) -> Addr

Returns an address of the proxy.

Source

pub fn node_launch_id(&self) -> NodeLaunchId

Returns a launch ID of the topology.

It can be used to distinguish produced artifacts (logs, dumps, metrics) from different concurrent tests if the custom implementation is used.

Source

pub fn unbounded_send<M: Message>(&self, message: M)

See Context::unbounded_send() for details.

Source

pub fn unbounded_send_to<M: Message>(&self, recipient: Addr, message: M)

Source

pub fn send<M: Message>(&self, message: M) -> impl Future<Output = ()> + '_

See Context::send() for details.

Source

pub fn send_to<M: Message>( &self, recipient: Addr, message: M, ) -> impl Future<Output = ()> + '_

See Context::send_to() for details.

Source

pub fn try_send<M: Message>(&self, message: M) -> Result<(), TrySendError<M>>

See Context::try_send() for details.

Source

pub fn try_send_to<M: Message>( &self, recipient: Addr, message: M, ) -> Result<(), TrySendError<M>>

See Context::try_send_to() for details.

Source

pub fn request_fallible<R: Request>( &self, request: R, ) -> impl Future<Output = Result<R::Response, RequestError>>

Same as Self::request, but doesn’t unwraps the error.

Source

pub fn request<R: Request>( &self, request: R, ) -> impl Future<Output = R::Response>

See Context::request() for details.

Source

pub fn request_to_fallible<R: Request>( &self, recipient: Addr, request: R, ) -> impl Future<Output = Result<R::Response, RequestError>>

Same as Self::request_to, but doesn’t unwraps the errors.

Source

pub fn request_to<R: Request>( &self, recipient: Addr, request: R, ) -> impl Future<Output = R::Response>

See Context::request_to() for details.

Source

pub fn respond<R: Request>( &self, token: ResponseToken<R>, response: R::Response, )

See Context::respond() for details.

Source

pub fn recv(&mut self) -> impl Future<Output = Envelope> + '_

See Context::recv() for details.

Source

pub async fn try_recv(&mut self) -> Option<Envelope>

See Context::try_recv() for details.

Source

pub async fn sync(&mut self)

Waits until the testable actor handles all previously sent messages.

Now it’s implemented as multiple calls yield_now(), but the implementation can be changed in the future.

Source

pub fn set_recv_timeout(&mut self, recv_timeout: Duration)

Sets message wait time for recv call.

Source

pub async fn subproxy(&self) -> Proxy

Creates a subproxy with a different address. The main purpose is to test send_to(..) and request_to(..) calls.

Source

pub async fn finished(&self)

Waits until the testable actor finishes.

Source

pub fn close(&self)

Closes a mailbox of the proxy.

Auto Trait Implementations§

§

impl !Freeze for Proxy

§

impl !RefUnwindSafe for Proxy

§

impl Send for Proxy

§

impl !Sync for Proxy

§

impl Unpin for Proxy

§

impl UnsafeUnpin for Proxy

§

impl !UnwindSafe for Proxy

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more