pub struct WriteCallback { /* private fields */ }Expand description
Handle to a registered write callback. Drop to unregister.
Returned by Database::on_write. While this
value is alive the callback fires on writes; dropping it removes the
registration. Use detach to keep the callback registered
for the life of the Instance when you don’t want to manage the lifetime
yourself.
Holds a weak reference to the Instance, so a WriteCallback will not
keep the Instance alive on its own.
Implementations§
Source§impl WriteCallback
impl WriteCallback
Sourcepub fn detach(self)
pub fn detach(self)
Consume the handle without unregistering. The callback remains active
for the life of the Instance.
Implementation note: this sets a flag rather than calling mem::forget
so that field destructors (the WeakInstance’s weak count, the
tree_id’s heap allocation) still run — only our Drop impl is
short-circuited.
Trait Implementations§
Source§impl Debug for WriteCallback
impl Debug for WriteCallback
Auto Trait Implementations§
impl Freeze for WriteCallback
impl !RefUnwindSafe for WriteCallback
impl Send for WriteCallback
impl Sync for WriteCallback
impl Unpin for WriteCallback
impl UnsafeUnpin for WriteCallback
impl !UnwindSafe for WriteCallback
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
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more