pub enum AnySnapshot {
Readonly(Arc<ReadonlySnapshot>),
Mutable(Arc<MutableSnapshot>),
NestedReadonly(Arc<NestedReadonlySnapshot>),
NestedMutable(Arc<NestedMutableSnapshot>),
Global(Arc<GlobalSnapshot>),
TransparentMutable(Arc<TransparentObserverMutableSnapshot>),
TransparentReadonly(Arc<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(Arc<ReadonlySnapshot>)
Mutable(Arc<MutableSnapshot>)
NestedReadonly(Arc<NestedReadonlySnapshot>)
NestedMutable(Arc<NestedMutableSnapshot>)
Global(Arc<GlobalSnapshot>)
TransparentMutable(Arc<TransparentObserverMutableSnapshot>)
TransparentReadonly(Arc<TransparentObserverSnapshot>)
Implementations§
Source§impl AnySnapshot
impl AnySnapshot
Sourcepub fn snapshot_id(&self) -> SnapshotId
pub fn snapshot_id(&self) -> SnapshotId
Get the snapshot ID.
Sourcepub fn invalid(&self) -> SnapshotIdSet
pub fn invalid(&self) -> SnapshotIdSet
Get the set of invalid snapshot IDs.
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: &Arc<TransparentObserverMutableSnapshot>,
) -> bool
pub fn is_same_transparent( &self, other: &Arc<TransparentObserverMutableSnapshot>, ) -> bool
Check if this snapshot refers to the same transparent snapshot.
Sourcepub fn is_same_transparent_mutable(
&self,
other: &Arc<TransparentObserverMutableSnapshot>,
) -> bool
pub fn is_same_transparent_mutable( &self, other: &Arc<TransparentObserverMutableSnapshot>, ) -> bool
Check if this snapshot refers to the same transparent mutable snapshot.
Sourcepub fn is_same_transparent_readonly(
&self,
other: &Arc<TransparentObserverSnapshot>,
) -> bool
pub fn is_same_transparent_readonly( &self, other: &Arc<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: Arc<dyn StateObject>)
pub fn record_write(&self, state: Arc<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).
Trait Implementations§
Source§impl Clone for AnySnapshot
impl Clone for AnySnapshot
Source§fn clone(&self) -> AnySnapshot
fn clone(&self) -> AnySnapshot
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more