WriteVolatile

Trait WriteVolatile 

Source
pub trait WriteVolatile {
    // Required method
    fn write_volatile<B: BitmapSlice>(
        &mut self,
        buf: &VolatileSlice<'_, B>,
    ) -> Result<usize, VolatileMemoryError>;

    // Provided method
    fn write_all_volatile<B: BitmapSlice>(
        &mut self,
        buf: &VolatileSlice<'_, B>,
    ) -> Result<(), VolatileMemoryError> { ... }
}
Expand description

A version of the standard library’s Write trait that operates on volatile memory instead of slices.

This trait is needed as rust slices (&[u8] and &mut [u8]) cannot be used when operating on guest memory 1.

Required Methods§

Source

fn write_volatile<B: BitmapSlice>( &mut self, buf: &VolatileSlice<'_, B>, ) -> Result<usize, VolatileMemoryError>

Tries to write some bytes from the given VolatileSlice buffer, returning how many bytes were written.

The behavior of implementations should be identical to Write::write

Provided Methods§

Source

fn write_all_volatile<B: BitmapSlice>( &mut self, buf: &VolatileSlice<'_, B>, ) -> Result<(), VolatileMemoryError>

Tries write the entire content of the given VolatileSlice buffer to self returning an error if not all bytes could be written.

The default implementation is identical to that of Write::write_all

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl WriteVolatile for &File

Available on crate feature rawfd only.
Source§

impl WriteVolatile for &Stdout

Available on crate feature rawfd only.
Source§

impl WriteVolatile for &TcpStream

Available on crate feature rawfd only.
Source§

impl WriteVolatile for &BorrowedFd<'_>

Available on crate feature rawfd only.
Source§

impl WriteVolatile for &OwnedFd

Available on crate feature rawfd only.
Source§

impl WriteVolatile for &UnixStream

Available on crate feature rawfd only.
Source§

impl WriteVolatile for &mut File

Available on crate feature rawfd only.
Source§

impl WriteVolatile for &mut TcpStream

Available on crate feature rawfd only.
Source§

impl WriteVolatile for &mut BorrowedFd<'_>

Available on crate feature rawfd only.
Source§

impl WriteVolatile for &mut OwnedFd

Available on crate feature rawfd only.
Source§

impl WriteVolatile for &mut UnixStream

Available on crate feature rawfd only.
Source§

impl WriteVolatile for &mut [u8]

Source§

impl WriteVolatile for Vec<u8>

Source§

impl WriteVolatile for File

Available on crate feature rawfd only.
Source§

impl WriteVolatile for Cursor<&mut [u8]>

Source§

impl WriteVolatile for Stdout

Available on crate feature rawfd only.
Source§

impl WriteVolatile for TcpStream

Available on crate feature rawfd only.
Source§

impl WriteVolatile for BorrowedFd<'_>

Available on crate feature rawfd only.
Source§

impl WriteVolatile for OwnedFd

Available on crate feature rawfd only.
Source§

impl WriteVolatile for UnixStream

Available on crate feature rawfd only.

Implementors§