[][src]Struct actix::actors::mocker::Mocker

pub struct Mocker<T: Sized + 'static> { /* fields omitted */ }

This actor is able to wrap another actor and accept all the messages the wrapped actor can, passing it to a closure which can mock the response of the actor.

Methods

impl<T> Mocker<T>
[src]

pub fn mock(
    mock: Box<dyn FnMut(Box<dyn Any>, &mut Context<Mocker<T>>) -> Box<dyn Any>>
) -> Mocker<T>
[src]

Trait Implementations

impl<T: Sized + 'static> Actor for Mocker<T>
[src]

type Context = Context<Self>

Actor execution context type

fn started(&mut self, ctx: &mut Self::Context)
[src]

Called when an actor gets polled the first time.

fn stopping(&mut self, ctx: &mut Self::Context) -> Running
[src]

Called after an actor is in Actor::Stopping state. Read more

fn stopped(&mut self, ctx: &mut Self::Context)
[src]

Called after an actor is stopped. Read more

fn start(self) -> Addr<Self> where
    Self: Actor<Context = Context<Self>>, 
[src]

Start a new asynchronous actor, returning its address. Read more

fn start_default() -> Addr<Self> where
    Self: Actor<Context = Context<Self>> + Default
[src]

Construct and start a new asynchronous actor, returning its address. Read more

fn create<F>(f: F) -> Addr<Self> where
    Self: Actor<Context = Context<Self>>,
    F: FnOnce(&mut Context<Self>) -> Self + 'static, 
[src]

Start a new asynchronous actor given a Context. Read more

impl<T> Supervised for Mocker<T>
[src]

fn restarting(&mut self, ctx: &mut Self::Context)
[src]

Called when the supervisor restarts a failed actor.

impl<M: 'static, T: Sized + 'static> Handler<M> for Mocker<T> where
    M: Message,
    <M as Message>::Result: MessageResponse<Mocker<T>, M>, 
[src]

type Result = M::Result

The type of value that this handler will return.

impl<T: ArbiterService> ArbiterService for Mocker<T>
[src]

fn start_service() -> Addr<Self>
[src]

Construct and start arbiter service

fn service_started(&mut self, ctx: &mut Context<Self>)
[src]

Method is called during service initialization.

fn from_registry() -> Addr<Self>
[src]

Get actor's address from arbiter registry

impl<T: SystemService> SystemService for Mocker<T>
[src]

fn start_service(sys: &Addr<Arbiter>) -> Addr<Self>
[src]

Construct and start system service

fn service_started(&mut self, ctx: &mut Context<Self>)
[src]

Method is called during service initialization.

fn from_registry() -> Addr<Self>
[src]

Get actor's address from system registry

impl<T> Default for Mocker<T>
[src]

Auto Trait Implementations

impl<T> !Send for Mocker<T>

impl<T> !Sync for Mocker<T>

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T