pub enum AnySnapshot {
Readonly(Rc<ReadonlySnapshot>),
Mutable(Rc<MutableSnapshot>),
NestedReadonly(Rc<NestedReadonlySnapshot>),
NestedMutable(Rc<NestedMutableSnapshot>),
Global(Rc<GlobalSnapshot>),
TransparentMutable(Rc<TransparentObserverMutableSnapshot>),
TransparentReadonly(Rc<TransparentObserverSnapshot>),
}Expand description
Enum wrapper for all snapshot types.
This provides a type-safe way to work with different snapshot types without requiring trait objects, which avoids object-safety issues.
Variants§
Readonly(Rc<ReadonlySnapshot>)
Mutable(Rc<MutableSnapshot>)
NestedReadonly(Rc<NestedReadonlySnapshot>)
NestedMutable(Rc<NestedMutableSnapshot>)
Global(Rc<GlobalSnapshot>)
TransparentMutable(Rc<TransparentObserverMutableSnapshot>)
TransparentReadonly(Rc<TransparentObserverSnapshot>)
Implementations§
Source§impl AnySnapshot
impl AnySnapshot
Sourcepub fn snapshot_id(&self) -> SnapshotId
pub fn snapshot_id(&self) -> SnapshotId
Get the snapshot ID.
pub fn invalid(&self) -> SnapshotIdSet
Sourcepub fn is_valid(&self, id: SnapshotId) -> bool
pub fn is_valid(&self, id: SnapshotId) -> bool
Check if a snapshot ID is valid in this snapshot.
Sourcepub fn root(&self) -> AnySnapshot
pub fn root(&self) -> AnySnapshot
Get the root snapshot.
Sourcepub fn is_same_transparent(
&self,
other: &Rc<TransparentObserverMutableSnapshot>,
) -> bool
pub fn is_same_transparent( &self, other: &Rc<TransparentObserverMutableSnapshot>, ) -> bool
Check if this snapshot refers to the same transparent snapshot.
Sourcepub fn is_same_transparent_mutable(
&self,
other: &Rc<TransparentObserverMutableSnapshot>,
) -> bool
pub fn is_same_transparent_mutable( &self, other: &Rc<TransparentObserverMutableSnapshot>, ) -> bool
Check if this snapshot refers to the same transparent mutable snapshot.
Sourcepub fn is_same_transparent_readonly(
&self,
other: &Rc<TransparentObserverSnapshot>,
) -> bool
pub fn is_same_transparent_readonly( &self, other: &Rc<TransparentObserverSnapshot>, ) -> bool
Check if this snapshot refers to the same transparent readonly snapshot.
Sourcepub fn enter<T>(&self, f: impl FnOnce() -> T) -> T
pub fn enter<T>(&self, f: impl FnOnce() -> T) -> T
Enter this snapshot, making it current for the duration of the closure.
Sourcepub fn take_nested_snapshot(
&self,
read_observer: Option<ReadObserver>,
) -> AnySnapshot
pub fn take_nested_snapshot( &self, read_observer: Option<ReadObserver>, ) -> AnySnapshot
Take a nested read-only snapshot.
Sourcepub fn has_pending_changes(&self) -> bool
pub fn has_pending_changes(&self) -> bool
Check if there are pending changes.
Sourcepub fn is_disposed(&self) -> bool
pub fn is_disposed(&self) -> bool
Check if disposed.
Sourcepub fn record_read(&self, state: &dyn StateObject)
pub fn record_read(&self, state: &dyn StateObject)
Record a read.
Sourcepub fn record_write(&self, state: Rc<dyn StateObject>)
pub fn record_write(&self, state: Rc<dyn StateObject>)
Record a write.
Sourcepub fn apply(&self) -> SnapshotApplyResult
pub fn apply(&self) -> SnapshotApplyResult
Apply changes (only valid for mutable snapshots).
Sourcepub fn take_nested_mutable_snapshot(
&self,
read_observer: Option<ReadObserver>,
write_observer: Option<WriteObserver>,
) -> AnySnapshot
pub fn take_nested_mutable_snapshot( &self, read_observer: Option<ReadObserver>, write_observer: Option<WriteObserver>, ) -> AnySnapshot
Take a nested mutable snapshot (only valid for mutable snapshots).