pub async fn advance<'a, U, F, K>(&mut self, mut updates: F, scope: &Scope<'_>)
    where
        U: Schema,
        F: FnMut(u64) -> K,
        K: Pack<U>,
    {
        for client in self.clients.values_mut() {
            if let ClientState::Connected = client.state {
                let result = client
                    .channel
                    .send::<ServerMessage<(), U>, _>(
                        ServerMessageUpdatesPack {
                            updates: updates(self.current_step - client.next_update_step),
                            server_step: self.current_step,
                        },
                        scope,
                    )
                    .await;

                if let Err(err) = result {
                    tracing::error!("Client channel error: {}", err);
                    client.state = ClientState::Disconnected;
                }
            }
        }
        self.current_step += 1;
    }
/// Advances server-side simulation by one step.
/// Broadcasts updates to all clients.
Advances server-side simulation by one step.
Broadcasts updates to all clients.
Advances server - side simulation by one step . Broadcasts updates to all clients .
pub async fn advance<'a, U, F, K>(&mut self, mut updates: F, scope: &Scope<'_>)
    where
        U: Schema,
        F: FnMut(u64) -> K,
        K: Pack<U>,
    {
        for client in self.clients.values_mut() {
            if let ClientState::Connected = client.state {
                let result = client
                    .channel
                    .send::<ServerMessage<(), U>, _>(
                        ServerMessageUpdatesPack {
                            updates: updates(self.current_step - client.next_update_step),
                            server_step: self.current_step,
                        },
                        scope,
                    )
                    .await;
                if let Err(err) = result {
                    tracing::error!("Client channel error: {}", err);
                    client.state = ClientState::Disconnected;
                }
            }
        }
        self.current_step += 1;
    }
pub async fn advance < ' a , U , F , K > ( & mut self , mut updates : F , scope : & Scope < ' _ > ) where U : Schema , F : FnMut ( u64 ) -> K , K : Pack < U > , { for client in self . clients . values_mut ( ) { if let ClientState :: Connected = client . state { let result = client . channel . send :: < ServerMessage < ( ) , U > , _ > ( ServerMessageUpdatesPack { updates : updates ( self . current_step - client . next_update_step ) , server_step : self . current_step , } , scope , ) . await ; if let Err ( err ) = result { tracing :: error ! ( " " err ) ; client . state = ClientState :: Disconnected ; } } } self . current_step += 1 ; }
Advances server-side simulation by one step.
Advances server - side simulation by one step .
&mut self
updates
F
scope
&Scope<'_>