ChannelCapability

Trait ChannelCapability 

Source
pub trait ChannelCapability: Send + Sync {
    type Channel: Send;
    type StrongWriter: Send + Unpin;
    type WeakWriter: Send + Unpin;
    type StrongReader: Send + Unpin;
    type WeakReader: Send + Unpin;
    type Error: Into<GuestError>;

    // Required methods
    fn create(&self, size: GuestUint) -> Result<Self::Channel, Self::Error>;
    fn delete(&self, channel: Self::Channel) -> Result<(), Self::Error>;
    fn drain(&self, channel: &Self::Channel) -> Result<(), Self::Error>;
    fn downgrade_writer(
        &self,
        writer: Self::StrongWriter,
    ) -> Result<Self::WeakWriter, Self::Error>;
    fn downgrade_reader(
        &self,
        writer: Self::StrongReader,
    ) -> Result<Self::WeakReader, Self::Error>;
}
Expand description

The capabilities that any subsystem implementation needs to provide

Required Associated Types§

Required Methods§

Source

fn create(&self, size: GuestUint) -> Result<Self::Channel, Self::Error>

Create a new channel for transporting bytes

Source

fn delete(&self, channel: Self::Channel) -> Result<(), Self::Error>

Delete this channel

Source

fn drain(&self, channel: &Self::Channel) -> Result<(), Self::Error>

Terminate this channel whilst allowing unfinished reads/writes to continue

Source

fn downgrade_writer( &self, writer: Self::StrongWriter, ) -> Result<Self::WeakWriter, Self::Error>

Downgrade this strong writer to a weak variant

Source

fn downgrade_reader( &self, writer: Self::StrongReader, ) -> Result<Self::WeakReader, Self::Error>

Downgrade this strong writer to a weak variant

Implementations on Foreign Types§

Source§

impl<T> ChannelCapability for Arc<T>

Implementors§