pub struct ObservedContext<'a, 'o> { /* private fields */ }Expand description
A ContextAccess wrapper that delegates to an inner Context and
notifies a WriteObserver on every mutation.
Implementations§
Source§impl<'a, 'o> ObservedContext<'a, 'o>
impl<'a, 'o> ObservedContext<'a, 'o>
pub fn new( context: &'a mut Context, observer: &'o mut dyn WriteObserver, ) -> Self
Trait Implementations§
Source§impl ContextAccess for ObservedContext<'_, '_>
impl ContextAccess for ObservedContext<'_, '_>
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>
Auto Trait Implementations§
impl<'a, 'o> !RefUnwindSafe for ObservedContext<'a, 'o>
impl<'a, 'o> !Send for ObservedContext<'a, 'o>
impl<'a, 'o> !Sync for ObservedContext<'a, 'o>
impl<'a, 'o> !UnwindSafe for ObservedContext<'a, 'o>
impl<'a, 'o> Freeze for ObservedContext<'a, 'o>
impl<'a, 'o> Unpin for ObservedContext<'a, 'o>
impl<'a, 'o> UnsafeUnpin for ObservedContext<'a, 'o>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more