-
-
Save donjar/94f023a9b53301bacdd4d6a2eb4554fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use actix::prelude::*; | |
pub struct Msg { | |
} | |
impl Message for Msg { | |
type Result = (); | |
} | |
pub struct AsyncActorThatOnlySpewsState { | |
pub internal_state: i32, | |
} | |
impl Actor for AsyncActorThatOnlySpewsState { | |
type Context = Context<Self>; | |
} | |
impl Handler<Msg> for AsyncActorThatOnlySpewsState { | |
type Result = ResponseFuture<i32>; | |
fn handle(&mut self, msg: Msg, _ctx: &mut Context<Self>) -> Self::Result { | |
Box::pin(async move { | |
self.internal_state | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment