Struct virtio_queue::Descriptor
source · [−]#[repr(C)]pub struct Descriptor { /* private fields */ }
Expand description
A virtio descriptor constraints with C representation.
Example
use virtio_queue::{Descriptor, Queue};
use vm_memory::{GuestAddress, GuestMemoryMmap};
let m = &GuestMemoryMmap::<()>::from_ranges(&[(GuestAddress(0), 0x10000)]).unwrap();
// Populate the queue with descriptor chains and update the available ring accordingly.
let mut queue = populate_queue(m);
let mut i = queue.iter().unwrap();
let mut c = i.next().unwrap();
// Get the first descriptor and access its fields.
let desc = c.next().unwrap();
let _addr = desc.addr();
let _len = desc.len();
let _flags = desc.flags();
let _next = desc.next();
let _is_write_only = desc.is_write_only();
let _has_next = desc.has_next();
let _refers_to_ind_table = desc.refers_to_indirect_table();
Implementations
sourceimpl Descriptor
impl Descriptor
sourcepub fn addr(&self) -> GuestAddress
pub fn addr(&self) -> GuestAddress
Return the guest physical address of the descriptor buffer.
sourcepub fn flags(&self) -> u16
pub fn flags(&self) -> u16
Return the flags for this descriptor, including next, write and indirect bits.
sourcepub fn refers_to_indirect_table(&self) -> bool
pub fn refers_to_indirect_table(&self) -> bool
Check whether this descriptor refers to a buffer containing an indirect descriptor table.
sourcepub fn is_write_only(&self) -> bool
pub fn is_write_only(&self) -> bool
Check if the driver designated this as a write only descriptor.
If this is false, this descriptor is read only. Write only means the the emulated device can write and the driver can read.
Trait Implementations
sourceimpl ByteValued for Descriptor
impl ByteValued for Descriptor
sourcefn from_slice(data: &[u8]) -> Option<&Self>
fn from_slice(data: &[u8]) -> Option<&Self>
Converts a slice of raw data into a reference of Self
. Read more
sourcefn from_mut_slice(data: &mut [u8]) -> Option<&mut Self>
fn from_mut_slice(data: &mut [u8]) -> Option<&mut Self>
Converts a mutable slice of raw data into a mutable reference of Self
. Read more
sourcefn as_slice(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
fn as_slice(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Converts a reference to self
into a slice of bytes. Read more
sourcefn as_mut_slice(&mut self) -> &mut [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
fn as_mut_slice(&mut self) -> &mut [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Converts a mutable reference to self
into a mutable slice of bytes. Read more
sourcefn as_bytes(&mut self) -> VolatileSlice<'_, ()>
fn as_bytes(&mut self) -> VolatileSlice<'_, ()>
Converts a mutable reference to self
into a VolatileSlice
. This is
useful because VolatileSlice
provides a Bytes<usize>
implementation. Read more
sourceimpl Clone for Descriptor
impl Clone for Descriptor
sourcefn clone(&self) -> Descriptor
fn clone(&self) -> Descriptor
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Descriptor
impl Debug for Descriptor
sourceimpl Default for Descriptor
impl Default for Descriptor
sourcefn default() -> Descriptor
fn default() -> Descriptor
Returns the “default value” for a type. Read more
impl Copy for Descriptor
Auto Trait Implementations
impl RefUnwindSafe for Descriptor
impl Send for Descriptor
impl Sync for Descriptor
impl Unpin for Descriptor
impl UnwindSafe for Descriptor
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more