pub struct TransparentObserverMutableSnapshot { /* private fields */ }Expand description
A transparent mutable snapshot that allows observer replacement.
This snapshot type is optimized for cases where observers need to be temporarily added or removed without creating a new snapshot structure.
§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 TransparentObserverMutableSnapshot
impl TransparentObserverMutableSnapshot
pub fn new( id: SnapshotId, invalid: SnapshotIdSet, read_observer: Option<ReadObserver>, write_observer: Option<WriteObserver>, parent: Option<Weak<TransparentObserverMutableSnapshot>>, ) -> Arc<Self>
Sourcepub fn set_read_observer(&self, _observer: Option<ReadObserver>)
pub fn set_read_observer(&self, _observer: Option<ReadObserver>)
Set the read observer (only allowed if reusable).
Sourcepub fn set_write_observer(&self, _observer: Option<WriteObserver>)
pub fn set_write_observer(&self, _observer: Option<WriteObserver>)
Set the write observer (only allowed if reusable).
pub fn snapshot_id(&self) -> SnapshotId
pub fn invalid(&self) -> SnapshotIdSet
pub fn read_only(&self) -> bool
pub fn root_transparent_mutable(self: &Arc<Self>) -> Arc<Self>
pub fn enter<T>(self: &Arc<Self>, f: impl FnOnce() -> T) -> T
pub fn take_nested_snapshot( &self, read_observer: Option<ReadObserver>, ) -> Arc<ReadonlySnapshot>
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 close(&self)
pub fn is_disposed(&self) -> bool
pub fn apply(&self) -> SnapshotApplyResult
pub fn take_nested_mutable_snapshot( &self, read_observer: Option<ReadObserver>, write_observer: Option<WriteObserver>, ) -> Arc<TransparentObserverMutableSnapshot>
Auto Trait Implementations§
impl !Freeze for TransparentObserverMutableSnapshot
impl !RefUnwindSafe for TransparentObserverMutableSnapshot
impl !Send for TransparentObserverMutableSnapshot
impl !Sync for TransparentObserverMutableSnapshot
impl Unpin for TransparentObserverMutableSnapshot
impl !UnwindSafe for TransparentObserverMutableSnapshot
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