-
-
Save angelsl/2669b66c7001892972e34ecc1d09eb66 to your computer and use it in GitHub Desktop.
This file contains 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 = Result<i32, ()>; | |
} | |
pub struct AsyncActorThatOnlySpewsState { | |
pub internal_state: i32, | |
} | |
impl Actor for AsyncActorThatOnlySpewsState { | |
type Context = Context<Self>; | |
} | |
impl Handler<Msg> for AsyncActorThatOnlySpewsState { | |
type Result = ResponseFuture<Result<i32, ()>>; | |
fn handle(&mut self, msg: Msg, _ctx: &mut Context<Self>) -> Self::Result { | |
let state = self.internal_state; | |
Box::pin(async move { | |
Ok(state) | |
}) | |
} | |
} | |
fn main() { | |
println!("Hello, world!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment