Actix WebSocket处理程序不是actorfuture

时间:2019-10-20 15:09:35

标签: rust-actix actix-web

我试图通过制作一个简单的网络套接字游戏来学习Actix。但是我遇到了以下错误。

.then(|res,act,ctx| {});
^^^^ the trait `actix::ActorFuture` is not implemented for `()`

对于以下处理程序

impl Handler<JoinGame> for GameServer {
    type Result = Result<String, ServerError>;

    fn handle(&mut self, msg: JoinGame, ctx: &mut Context<Self>) -> Self::Result {
        let JoinGame { id, code } = msg;
        if let Some(game) = self.games.get_mut(&code) {
            if let Some(addr) = &self.sessions.get(&id) {
                if game.users.insert(id) {
                    addr.send(UserInfoRequest {})
                    .into_actor(self)
                    .then(|res,act,ctx| {});
                }
            }
        }
}
impl Actor for GameServer {
    /// We are going to use simple Context, we just need ability to communicate
    /// with other actors.
    type Context = Context<Self>;
}

如何实现ActorFuture特性?我在哪里可以了解不同的情况?我很难搜索示例和指南。

谢谢, 路德维希

0 个答案:

没有答案