Trait ReplayWorld

Source
pub trait ReplayWorld {
    type Error;

    const SCHEMA: u64;
    const VERSION: u32;
    const TICK_HZ: u16;

    // Required methods
    fn context(&self) -> Result<u64, Self::Error>;
    fn restore(&mut self, state: &[u8]) -> Result<(), Self::Error>;
    fn step(
        &mut self,
        input: &[u8],
        expected: EventIter<'_>,
    ) -> Result<(), Self::Error>;
    fn state_hash(&self) -> Result<u64, Self::Error>;
}
Expand description

Restore must stage/validate before replacing the game. Step applies recorded inputs exactly once; expected events are for comparison/presentation, not a second application of already simulated authoritative damage.

Required Associated Constants§

Required Associated Types§

Required Methods§

Source

fn context(&self) -> Result<u64, Self::Error>

Source

fn restore(&mut self, state: &[u8]) -> Result<(), Self::Error>

Source

fn step( &mut self, input: &[u8], expected: EventIter<'_>, ) -> Result<(), Self::Error>

Source

fn state_hash(&self) -> Result<u64, Self::Error>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§