pub async fn run(mut self, mut actor: ACTOR) {
        #![allow(clippy::mut_mut)] // Warning is spawned because of `futures::select`.

        // Acquire the lock on the mutex so addresses can be used to `await` until
        // the actor is stopped.
        let stop_handle = self.stop_handle.clone();
        let _mutex_handle = stop_handle.lock().await;

        actor.started().await;

        let mut running = true;
        while running {
            match self.receiver.next().await {
                Some(Signal::Message(mut envelope)) => {
                    let actor_pin = Pin::new(&mut actor);
                    let self_pin = Pin::new(&self);
                    envelope.handle(actor_pin, self_pin).await;
                }
                Some(Signal::Stop) | None => {
                    // Notify actor about being stopped.
                    if let ActorAction::Stop = actor.stopping().await {
                        // Actor agreed to stop, so actually stop the loop.
                        running = false;
                    }
                }
            }
        }

        // Notify actor that it was fully stopped.
        actor.stopped();
    }
/// Starts the message handling routine.
///
/// Future returned by this method should not normally be directly `await`ed,
/// but rather is expected to be used in some kind of `spawn` function of
/// the used runtime (e.g. `tokio::spawn` or `async_std::task::spawn`).
Starts the message handling routine.
Future returned by this method should not normally be directly `await`ed,
but rather is expected to be used in some kind of `spawn` function of
the used runtime .
Starts the message handling routine . Future returned by this method should not normally be directly ` await ` ed but rather is expected to be used in some kind of ` spawn ` function of the used runtime .
pub async fn run(mut self, mut actor: ACTOR) {
        #![allow(clippy::mut_mut)] // Warning is spawned because of `futures::select`.
        // Acquire the lock on the mutex so addresses can be used to `await` until
        // the actor is stopped.
        let stop_handle = self.stop_handle.clone();
        let _mutex_handle = stop_handle.lock().await;
        actor.started().await;
        let mut running = true;
        while running {
            match self.receiver.next().await {
                Some(Signal::Message(mut envelope)) => {
                    let actor_pin = Pin::new(&mut actor);
                    let self_pin = Pin::new(&self);
                    envelope.handle(actor_pin, self_pin).await;
                }
                Some(Signal::Stop) | None => {
                    // Notify actor about being stopped.
                    if let ActorAction::Stop = actor.stopping().await {
                        // Actor agreed to stop, so actually stop the loop.
                        running = false;
                    }
                }
            }
        }
        // Notify actor that it was fully stopped.
        actor.stopped();
    }
pub async fn run ( mut self , mut actor : ACTOR ) { # ! [ allow ( clippy mut_mut ) ] // Warning is spawned because of `futures::select`. // Acquire the lock on the mutex so addresses can be used to `await` until // the actor is stopped. let stop_handle = self . stop_handle . clone ( ) ; let _mutex_handle = stop_handle . lock ( ) . await ; actor . started ( ) . await ; let mut running = true ; while running { match self . receiver . next ( ) . await { Some ( Signal :: Message ( mut envelope ) ) => { let actor_pin = Pin :: new ( & mut actor ) ; let self_pin = Pin :: new ( & self ) ; envelope . handle ( actor_pin , self_pin ) . await ; } Some ( Signal :: Stop ) | None => { // Notify actor about being stopped. if let ActorAction :: Stop = actor . stopping ( ) . await { // Actor agreed to stop, so actually stop the loop. running = false ; } } } } // Notify actor that it was fully stopped. actor . stopped ( ) ; }
Starts the message handling routine.
Starts the message handling routine .
mut self
actor
ACTOR
mut self
actor
ACTOR