pub struct MutableSnapshot { /* private fields */ }Expand description
A mutable snapshot that allows isolated state changes.
Changes made in a mutable snapshot are isolated from other snapshots
until apply() is called, at which point they become visible atomically.
This is a root mutable snapshot (not nested).
§Thread Safety
Contains Cell<T> which is 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 MutableSnapshot
impl MutableSnapshot
Sourcepub fn new_root(
read_observer: Option<ReadObserver>,
write_observer: Option<WriteObserver>,
) -> Arc<Self>
pub fn new_root( read_observer: Option<ReadObserver>, write_observer: Option<WriteObserver>, ) -> Arc<Self>
Create a new root mutable snapshot using the global runtime.
Sourcepub fn new(
id: SnapshotId,
invalid: SnapshotIdSet,
read_observer: Option<ReadObserver>,
write_observer: Option<WriteObserver>,
base_parent_id: SnapshotId,
) -> Arc<Self>
pub fn new( id: SnapshotId, invalid: SnapshotIdSet, read_observer: Option<ReadObserver>, write_observer: Option<WriteObserver>, base_parent_id: SnapshotId, ) -> Arc<Self>
Create a new root mutable snapshot.
pub fn snapshot_id(&self) -> SnapshotId
pub fn invalid(&self) -> SnapshotIdSet
pub fn read_only(&self) -> bool
pub fn root_mutable(self: &Arc<Self>) -> Arc<Self>
pub fn enter<T>(self: &Arc<Self>, f: impl FnOnce() -> T) -> T
pub fn take_nested_snapshot( self: &Arc<Self>, read_observer: Option<ReadObserver>, ) -> Arc<ReadonlySnapshot>
pub fn has_pending_changes(&self) -> bool
pub fn pending_children(&self) -> Vec<SnapshotId> ⓘ
pub fn has_pending_children(&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 notify_objects_initialized(&self)
pub fn close(&self)
pub fn is_disposed(&self) -> bool
pub fn apply(&self) -> SnapshotApplyResult
pub fn take_nested_mutable_snapshot( self: &Arc<Self>, read_observer: Option<ReadObserver>, write_observer: Option<WriteObserver>, ) -> Arc<NestedMutableSnapshot>
Auto Trait Implementations§
impl !Freeze for MutableSnapshot
impl !RefUnwindSafe for MutableSnapshot
impl !Send for MutableSnapshot
impl !Sync for MutableSnapshot
impl Unpin for MutableSnapshot
impl !UnwindSafe for MutableSnapshot
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