pub struct ReadonlySnapshot { /* private fields */ }Expand description
A read-only snapshot of state at a specific point in time.
This snapshot cannot be used to modify state. Any attempts to write to state objects while this snapshot is active will fail.
§Thread Safety
Contains Cell<T> and RefCell<T> which are not Send/Sync. This is safe because
snapshots are stored in thread-local storage and never shared across threads. The Arc
is used for cheap cloning within a single thread, not for cross-thread sharing.
Implementations§
Source§impl ReadonlySnapshot
impl ReadonlySnapshot
Sourcepub fn new(
id: SnapshotId,
invalid: SnapshotIdSet,
read_observer: Option<ReadObserver>,
) -> Arc<Self>
pub fn new( id: SnapshotId, invalid: SnapshotIdSet, read_observer: Option<ReadObserver>, ) -> Arc<Self>
Create a new read-only snapshot.
pub fn snapshot_id(&self) -> SnapshotId
pub fn invalid(&self) -> SnapshotIdSet
pub fn read_only(&self) -> bool
pub fn root_readonly(&self) -> Arc<Self>
pub fn enter<T>(&self, f: impl FnOnce() -> T) -> T
pub fn take_nested_snapshot( &self, read_observer: Option<ReadObserver>, ) -> Arc<Self>
pub fn has_pending_changes(&self) -> bool
pub fn dispose(&self)
pub fn record_read(&self, state: &dyn StateObject)
pub fn record_write(&self, _state: Arc<dyn StateObject>)
pub fn is_disposed(&self) -> bool
Auto Trait Implementations§
impl !Freeze for ReadonlySnapshot
impl !RefUnwindSafe for ReadonlySnapshot
impl !Send for ReadonlySnapshot
impl !Sync for ReadonlySnapshot
impl Unpin for ReadonlySnapshot
impl !UnwindSafe for ReadonlySnapshot
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