DemoLike

Trait DemoLike 

Source
pub trait DemoLike {
    // Required method
    fn next_demo_chunk(
        &mut self,
        snap: &mut Snap,
    ) -> Result<Option<DemoChunk>, Box<dyn Error>>;

    // Provided methods
    fn next_demo_chunk_after(
        &mut self,
        snap: &mut Snap,
        after: i32,
    ) -> Result<Option<DemoChunk>, Box<dyn Error>> { ... }
    fn snaps_for_tick(
        &mut self,
        clock: &mut Clock,
        safe_tick_threshold: u32,
        from: &mut Snap,
        to: &mut Snap,
    ) -> Result<Option<i32>, Box<dyn Error>> { ... }
}

Required Methods§

Source

fn next_demo_chunk( &mut self, snap: &mut Snap, ) -> Result<Option<DemoChunk>, Box<dyn Error>>

Provided Methods§

Source

fn next_demo_chunk_after( &mut self, snap: &mut Snap, after: i32, ) -> Result<Option<DemoChunk>, Box<dyn Error>>

This method skips to at least the given tick. It might skip further than that, though typically not too far. Returns Ok(None), if the demo is over

Source

fn snaps_for_tick( &mut self, clock: &mut Clock, safe_tick_threshold: u32, from: &mut Snap, to: &mut Snap, ) -> Result<Option<i32>, Box<dyn Error>>

safe_tick_threshold is the amount of ticks, in which we expect at least 3 snapshots. This method will try to skip any amount of ticks according to safe_tick_threshold. And from there on out read each snap. Returns an error, if we skipped too far.

Implementations on Foreign Types§

Source§

impl DemoLike for DemoReader

Source§

fn next_demo_chunk( &mut self, snap: &mut Snap, ) -> Result<Option<DemoChunk>, Box<dyn Error>>

Implementors§