Skip to main content

WorldRunner

Trait WorldRunner 

Source
pub trait WorldRunner: 'static {
    const SELF_DRIVEN: bool;

    // Required method
    fn spawn<I, S, T>(
        host: &mut World,
        name: &'static str,
        command_capacity: usize,
        init: I,
        tick: T,
    ) -> WorldHandle
       where I: FnOnce(&mut World) -> S + Send + 'static,
             S: 'static,
             T: FnMut(&mut World, &ThreadControl, &mut S, f32) -> bool + Send + 'static;
}
Expand description

How a world is driven: on its own thread, or by the host’s frames.

A runner is a zero-sized choice made at the call site, so a bridge can offer both a threaded and a stepped world without a feature or a target check. The stepped runner needs no thread at all, so a target without threads can still build and drive every world.

Required Associated Constants§

Source

const SELF_DRIVEN: bool

Whether the runner drives the world on its own.

A world whose runner drives itself can open devices and sleep between ticks; a stepped world does neither, and its owner does both.

Required Methods§

Source

fn spawn<I, S, T>( host: &mut World, name: &'static str, command_capacity: usize, init: I, tick: T, ) -> WorldHandle
where I: FnOnce(&mut World) -> S + Send + 'static, S: 'static, T: FnMut(&mut World, &ThreadControl, &mut S, f32) -> bool + Send + 'static,

Spawn a world driven this way.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§