Skip to main content

ContextAccess

Trait ContextAccess 

Source
pub trait ContextAccess {
Show 14 methods // Required methods fn global(&self, idx: u32) -> &Value; fn set_global(&mut self, idx: u32, value: Value); fn visit_count(&self, id: DefinitionId) -> u32; fn increment_visit(&mut self, id: DefinitionId); fn turn_count(&self, id: DefinitionId) -> Option<u32>; fn set_turn_count(&mut self, id: DefinitionId, turn: u32); fn turn_index(&self) -> u32; fn increment_turn_index(&mut self); fn rng_seed(&self) -> i32; fn set_rng_seed(&mut self, seed: i32); fn previous_random(&self) -> i32; fn set_previous_random(&mut self, val: i32); fn next_random<R: StoryRng>(&self, seed: i32) -> i32; fn random_sequence<R: StoryRng>(&self, seed: i32, count: usize) -> Vec<i32>;
}
Expand description

Trait for accessing and mutating story execution state.

This is the interface between the VM and the mutable story state. Context implements it directly. ObservedContext wraps a Context and fires WriteObserver callbacks on mutations. Consumers can also implement this trait themselves to plug in custom observers (e.g. bevy events) or alternate storage backends.

This does NOT include Program, resolver, or any immutable data — it’s purely the mutable state surface.

Required Methods§

Source

fn global(&self, idx: u32) -> &Value

Source

fn set_global(&mut self, idx: u32, value: Value)

Source

fn visit_count(&self, id: DefinitionId) -> u32

Source

fn increment_visit(&mut self, id: DefinitionId)

Source

fn turn_count(&self, id: DefinitionId) -> Option<u32>

Source

fn set_turn_count(&mut self, id: DefinitionId, turn: u32)

Source

fn turn_index(&self) -> u32

Source

fn increment_turn_index(&mut self)

Source

fn rng_seed(&self) -> i32

Source

fn set_rng_seed(&mut self, seed: i32)

Source

fn previous_random(&self) -> i32

Source

fn set_previous_random(&mut self, val: i32)

Source

fn next_random<R: StoryRng>(&self, seed: i32) -> i32

Source

fn random_sequence<R: StoryRng>(&self, seed: i32, count: usize) -> Vec<i32>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§