pub struct CallbackSlot<T: ?Sized> { /* private fields */ }Expand description
Lets you replace a callback without registering another handler with Aeron.
Helpers such as AeronErrorHandlerSlot keep their callback here. If you replace
it while a call is running, that call finishes with the old callback. Later
calls use the new one.
use std::sync::Arc;
let slot = CallbackSlot::new();
slot.set(Arc::new(str::len));
assert_eq!(slot.with(|callback| callback("aeron")), Some(5));
slot.clear();
assert_eq!(slot.with(|callback| callback("aeron")), None);Implementations§
Trait Implementations§
Source§impl<T: ?Sized> Clone for CallbackSlot<T>
impl<T: ?Sized> Clone for CallbackSlot<T>
Auto Trait Implementations§
impl<T> Freeze for CallbackSlot<T>where
T: ?Sized,
impl<T> RefUnwindSafe for CallbackSlot<T>where
T: ?Sized,
impl<T> Send for CallbackSlot<T>
impl<T> Sync for CallbackSlot<T>
impl<T> Unpin for CallbackSlot<T>where
T: ?Sized,
impl<T> UnsafeUnpin for CallbackSlot<T>where
T: ?Sized,
impl<T> UnwindSafe for CallbackSlot<T>where
T: ?Sized,
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