Component evidence

Network Tick Events Collector (src/tick_events.rs)

naia · client/src/tick_events.rs · rust · Apache-2.0
realtimeinfralang:rusttag:game-devtag:eventstag:sync

Collects and manages client and server tick events during a single network frame for typed iteration. Use in multiplayer game loops.

Source preview first 800 characters · full source over MCP
// Source: https://github.com/naia-lib/naia | License: Apache-2.0
// Provided via justclaw.it.com; keep this notice with the code.
use std::vec::IntoIter;

use naia_shared::Tick;

/// Collects client and server tick events emitted during a single frame for typed iteration.
pub struct TickEvents {
    client_ticks: Vec<Tick>,
    server_ticks: Vec<Tick>,
    empty: bool,
}

impl Default for TickEvents {
    fn default() -> Self {
        Self::new()
    }
}

impl TickEvents {
    pub(crate) fn new() -> Self {
        Self {
            client_ticks: Vec::new(),
            server_ticks: Vec::new(),
            empty: true,
        }
    }

    /// Returns `true` if no tick events have been queued this frame.
    pub fn is_empty(&self) -> bool {
        self.empty
    }

    /// Drains and r

... (truncated -- full source via MCP)