pub struct BufferedNotify<N: DriverNotify>(/* private fields */);
Expand description
Buffering wrapper for DriverNotify
Typically notifying a driver is an expensive operation and when processing large numbers of
chains a device may wish to trade of latency for throughput and delay submitting a notification.
BufferedNotify
implements DriverNotify
, but just stores the notification locally until
the BufferedNotify::flush
method is called, which then calls the underlying
DriverNotify::notify
.
Any outstanding notifications will automatically be flushed on drop
.
The BufferedNotify
uses an Arc
internally and so can be Clone
to easily give to
multiple queues.
Implementations§
Source§impl<N: DriverNotify> BufferedNotify<N>
impl<N: DriverNotify> BufferedNotify<N>
Sourcepub fn new(notify: N) -> BufferedNotify<N>
pub fn new(notify: N) -> BufferedNotify<N>
Construct a BufferedNotify
wrapping a DriverNotify
Sourcepub fn flush(&self)
pub fn flush(&self)
Flush any pending notification.
If this BufferedNotify
has been notify
since the last call to flush
,
calls DriverNotify::notify
on the wrapped DriverNotify
.
Trait Implementations§
Source§impl<N: DriverNotify> Clone for BufferedNotify<N>
impl<N: DriverNotify> Clone for BufferedNotify<N>
Source§fn clone(&self) -> BufferedNotify<N>
fn clone(&self) -> BufferedNotify<N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<N: DriverNotify> DriverNotify for BufferedNotify<N>
impl<N: DriverNotify> DriverNotify for BufferedNotify<N>
Auto Trait Implementations§
impl<N> Freeze for BufferedNotify<N>
impl<N> RefUnwindSafe for BufferedNotify<N>where
N: RefUnwindSafe,
impl<N> Send for BufferedNotify<N>
impl<N> Sync for BufferedNotify<N>
impl<N> Unpin for BufferedNotify<N>
impl<N> UnwindSafe for BufferedNotify<N>where
N: RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)