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>

source

pub fn new(notify: N) -> BufferedNotify<N>

Construct a BufferedNotify wrapping a DriverNotify

source

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>

source§

fn clone(&self) -> BufferedNotify<N>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<N: DriverNotify> DriverNotify for BufferedNotify<N>

source§

fn notify(&self)

Driver requires a notification. Read more

Auto Trait Implementations§

§

impl<N> Freeze for BufferedNotify<N>

§

impl<N> RefUnwindSafe for BufferedNotify<N>
where N: RefUnwindSafe,

§

impl<N> Send for BufferedNotify<N>
where N: Sync + Send,

§

impl<N> Sync for BufferedNotify<N>
where N: Sync + Send,

§

impl<N> Unpin for BufferedNotify<N>

§

impl<N> UnwindSafe for BufferedNotify<N>
where N: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.