Struct vmm_vhost::message::VhostUserMsgHeader
source · #[repr(C, packed(1))]pub struct VhostUserMsgHeader<R: Req> {
request: u32,
flags: u32,
size: u32,
_r: PhantomData<R>,
}
Expand description
Common message header for vhost-user requests and replies. A vhost-user message consists of 3 header fields and an optional payload. All numbers are in the machine native byte order.
Fields§
§request: u32
§flags: u32
§size: u32
§_r: PhantomData<R>
Implementations§
source§impl<R: Req> VhostUserMsgHeader<R>
impl<R: Req> VhostUserMsgHeader<R>
sourcepub fn new(request: R, flags: u32, size: u32) -> Self
pub fn new(request: R, flags: u32, size: u32) -> Self
Create a new instance of VhostUserMsgHeader
.
sourcepub fn get_version(&self) -> u32
pub fn get_version(&self) -> u32
Get message version number.
sourcepub fn set_version(&mut self, ver: u32)
pub fn set_version(&mut self, ver: u32)
Set message version number.
sourcepub fn is_need_reply(&self) -> bool
pub fn is_need_reply(&self) -> bool
Check whether reply for this message is requested.
sourcepub fn set_need_reply(&mut self, need_reply: bool)
pub fn set_need_reply(&mut self, need_reply: bool)
Mark that reply for this message is needed.
sourcepub fn is_reply_for(&self, req: &VhostUserMsgHeader<R>) -> bool
pub fn is_reply_for(&self, req: &VhostUserMsgHeader<R>) -> bool
Check whether it’s the reply message for the request req
.
Trait Implementations§
source§impl<R: Req> AsBytes for VhostUserMsgHeader<R>where
u32: AsBytes,
PhantomData<R>: AsBytes,
impl<R: Req> AsBytes for VhostUserMsgHeader<R>where
u32: AsBytes,
PhantomData<R>: AsBytes,
§fn as_bytes_mut(&mut self) -> &mut [u8] ⓘwhere
Self: FromBytes,
fn as_bytes_mut(&mut self) -> &mut [u8] ⓘwhere
Self: FromBytes,
Gets the bytes of this value mutably. Read more
§fn write_to_prefix(&self, bytes: &mut [u8]) -> Option<()>
fn write_to_prefix(&self, bytes: &mut [u8]) -> Option<()>
source§impl<R: Req> Clone for VhostUserMsgHeader<R>
impl<R: Req> Clone for VhostUserMsgHeader<R>
source§fn clone(&self) -> VhostUserMsgHeader<R>
fn clone(&self) -> VhostUserMsgHeader<R>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<R: Req> Debug for VhostUserMsgHeader<R>
impl<R: Req> Debug for VhostUserMsgHeader<R>
source§impl<R: Req> Default for VhostUserMsgHeader<R>
impl<R: Req> Default for VhostUserMsgHeader<R>
source§impl<R: Req> FromBytes for VhostUserMsgHeader<R>where
u32: FromBytes,
PhantomData<R>: FromBytes,
impl<R: Req> FromBytes for VhostUserMsgHeader<R>where
u32: FromBytes,
PhantomData<R>: FromBytes,
§fn slice_from_prefix(bytes: &[u8], count: usize) -> Option<(&[Self], &[u8])>where
Self: Sized,
fn slice_from_prefix(bytes: &[u8], count: usize) -> Option<(&[Self], &[u8])>where
Self: Sized,
Interprets the prefix of the given
bytes
as a &[Self]
with length
equal to count
without copying. Read more§fn slice_from_suffix(bytes: &[u8], count: usize) -> Option<(&[u8], &[Self])>where
Self: Sized,
fn slice_from_suffix(bytes: &[u8], count: usize) -> Option<(&[u8], &[Self])>where
Self: Sized,
Interprets the suffix of the given
bytes
as a &[Self]
with length
equal to count
without copying. Read more§fn mut_slice_from_prefix(
bytes: &mut [u8],
count: usize
) -> Option<(&mut [Self], &mut [u8])>where
Self: Sized + AsBytes,
fn mut_slice_from_prefix(
bytes: &mut [u8],
count: usize
) -> Option<(&mut [Self], &mut [u8])>where
Self: Sized + AsBytes,
Interprets the prefix of the given
bytes
as a &mut [Self]
with length
equal to count
without copying. Read more§fn mut_slice_from_suffix(
bytes: &mut [u8],
count: usize
) -> Option<(&mut [u8], &mut [Self])>where
Self: Sized + AsBytes,
fn mut_slice_from_suffix(
bytes: &mut [u8],
count: usize
) -> Option<(&mut [u8], &mut [Self])>where
Self: Sized + AsBytes,
Interprets the suffix of the given
bytes
as a &mut [Self]
with length
equal to count
without copying. Read more§fn read_from_prefix(bytes: &[u8]) -> Option<Self>where
Self: Sized,
fn read_from_prefix(bytes: &[u8]) -> Option<Self>where
Self: Sized,
source§impl<R: Req> FromZeroes for VhostUserMsgHeader<R>where
u32: FromZeroes,
PhantomData<R>: FromZeroes,
impl<R: Req> FromZeroes for VhostUserMsgHeader<R>where
u32: FromZeroes,
PhantomData<R>: FromZeroes,
source§impl<R: Req> PartialEq for VhostUserMsgHeader<R>
impl<R: Req> PartialEq for VhostUserMsgHeader<R>
source§impl<T: Req> VhostUserMsgValidator for VhostUserMsgHeader<T>
impl<T: Req> VhostUserMsgValidator for VhostUserMsgHeader<T>
impl<R: Copy + Req> Copy for VhostUserMsgHeader<R>
Auto Trait Implementations§
impl<R> RefUnwindSafe for VhostUserMsgHeader<R>where
R: RefUnwindSafe,
impl<R> Send for VhostUserMsgHeader<R>
impl<R> Sync for VhostUserMsgHeader<R>
impl<R> Unpin for VhostUserMsgHeader<R>where
R: Unpin,
impl<R> UnwindSafe for VhostUserMsgHeader<R>where
R: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more