Обработчик веб-сокетов Actix - не будущее - PullRequest
0 голосов
/ 20 октября 2019

Я пытаюсь выучить 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? Где я могу прочитать о различных контекстах? Мне трудно искать примеры и руководства.

Спасибо, Людвиг

...