Skip to content

Instantly share code, notes, and snippets.

@donjar
Created February 11, 2020 06:34
Show Gist options
  • Save donjar/94f023a9b53301bacdd4d6a2eb4554fb to your computer and use it in GitHub Desktop.
Save donjar/94f023a9b53301bacdd4d6a2eb4554fb to your computer and use it in GitHub Desktop.
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