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 more