Skip to main content

TickEngine

Struct TickEngine 

Source
pub struct TickEngine { /* private fields */ }
Expand description

Single-threaded tick engine for Lockstep mode.

Owns all simulation state and executes ticks synchronously. Each execute_tick() call runs the full propagator pipeline, publishes a snapshot, and returns receipts for any submitted commands.

Implementations§

Source§

impl TickEngine

Source

pub fn new(config: WorldConfig) -> Result<Self, ConfigError>

Construct a new tick engine from a WorldConfig.

Validates the configuration, builds the read resolution plan, constructs the arena, and pre-computes the base field set. Consumes the WorldConfig.

Source

pub fn submit_commands(&mut self, commands: Vec<Command>) -> Vec<Receipt>

Submit commands to be processed in the next tick.

Returns one receipt per command indicating acceptance or rejection.

Source

pub fn execute_tick(&mut self) -> Result<TickResult, TickError>

Execute one tick.

Runs the full propagator pipeline, publishes the snapshot, and returns receipts plus metrics. On propagator failure, the tick is rolled back atomically (the staging buffer is abandoned).

Source

pub fn reset(&mut self) -> Result<(), ConfigError>

Reset the engine to its initial state.

Source

pub fn snapshot(&self) -> Snapshot<'_>

Get a read-only snapshot of the current published generation.

Source

pub fn owned_snapshot(&self) -> OwnedSnapshot

Get an owned, thread-safe snapshot of the current published generation.

Unlike TickEngine::snapshot(), the returned OwnedSnapshot owns clones of the segment data and can be sent across thread boundaries.

Source

pub fn current_tick(&self) -> TickId

Current tick ID.

Source

pub fn is_tick_disabled(&self) -> bool

Whether ticking is disabled due to consecutive rollbacks.

Source

pub fn consecutive_rollback_count(&self) -> u32

Number of consecutive rollbacks since the last successful tick.

Source

pub fn last_metrics(&self) -> &StepMetrics

Metrics from the most recent successful tick.

Source

pub fn space(&self) -> &dyn Space

The spatial topology for this engine.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.