Trait SimpleVmbusDevice

Source
pub trait SimpleVmbusDevice: 'static + Send {
    type SavedState: SavedStateRoot + Send;
    type Runner: 'static + Send;

    // Required methods
    fn offer(&self) -> OfferParams;
    fn inspect(&mut self, req: Request<'_>, runner: Option<&mut Self::Runner>);
    fn open(
        &mut self,
        channel: RawAsyncChannel<GpadlRingMem>,
        guest_memory: GuestMemory,
    ) -> Result<Self::Runner, ChannelOpenError>;
    fn run<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        stop: &'life1 mut StopTask<'life2>,
        runner: &'life3 mut Self::Runner,
    ) -> Pin<Box<dyn Future<Output = Result<(), Cancelled>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn supports_save_restore(
        &mut self,
    ) -> Option<&mut dyn SaveRestoreSimpleVmbusDevice<SavedState = Self::SavedState, Runner = Self::Runner>>;

    // Provided method
    fn close<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

A trait implemented by a simple vmbus device with no subchannels.

Required Associated Types§

Source

type SavedState: SavedStateRoot + Send

The saved state type.

Source

type Runner: 'static + Send

The type used to run an open channel.

Required Methods§

Source

fn offer(&self) -> OfferParams

The channel offer parameters.

Source

fn inspect(&mut self, req: Request<'_>, runner: Option<&mut Self::Runner>)

Inspects a channel.

Source

fn open( &mut self, channel: RawAsyncChannel<GpadlRingMem>, guest_memory: GuestMemory, ) -> Result<Self::Runner, ChannelOpenError>

Opens the channel, returning the runner to use to run the channel.

When the channel is closed, the runner will be dropped.

Source

fn run<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, stop: &'life1 mut StopTask<'life2>, runner: &'life3 mut Self::Runner, ) -> Pin<Box<dyn Future<Output = Result<(), Cancelled>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Runs an open channel until stop is signaled.

Source

fn supports_save_restore( &mut self, ) -> Option<&mut dyn SaveRestoreSimpleVmbusDevice<SavedState = Self::SavedState, Runner = Self::Runner>>

Returns a trait used to save/restore the device.

Returns None if the device should be revoked and reoffered on restore.

Provided Methods§

Source

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Closes the channel after the runner has been dropped.

Implementors§