pub struct History<S: Snapshot> { /* private fields */ }Expand description
A snapshot in flight from producer to consumer. #[must_use] +
runtime drop-bomb together approximate linear typing: forgetting
to consume History panics in debug builds, and clippy flags
the dropped result in CI.
The only way to consume History is to pass it to
Attach<Subscribed>::replay(), which moves the inner snapshot
into the consumer and defuses the bomb.
Implementations§
Source§impl<S: Snapshot> History<S>
impl<S: Snapshot> History<S>
Sourcepub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Move out the snapshot, defusing the drop-bomb. Called inside
Attach::replay. Public so external code that needs to
inspect the snapshot can do so without panicking on drop.
Sourcepub fn size_bytes(&self) -> usize
pub fn size_bytes(&self) -> usize
Approximate byte size — useful for tracing replay cost.
Auto Trait Implementations§
impl<S> Freeze for History<S>where
S: Freeze,
impl<S> RefUnwindSafe for History<S>where
S: RefUnwindSafe,
impl<S> Send for History<S>
impl<S> Sync for History<S>
impl<S> Unpin for History<S>where
S: Unpin,
impl<S> UnsafeUnpin for History<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for History<S>where
S: UnwindSafe,
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