virtio_device::util

Struct BufferedNotify

Source
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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,

Source§

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>,

Source§

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>,

Source§

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.