vm-migration: add safety comments for impl ByteValued

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu 2021-11-17 13:44:53 +00:00 committed by Rob Bradford
parent 94fcfa9f1f
commit 1a2b01888c

View File

@ -57,6 +57,9 @@ pub struct Request {
length: u64, // Length of payload for command excluding the Request struct
}
// SAFETY: Request contains a series of integers with no implicit padding
unsafe impl ByteValued for Request {}
impl Request {
pub fn new(command: Command, length: u64) -> Self {
Self {
@ -112,8 +115,6 @@ impl Request {
}
}
unsafe impl ByteValued for Request {}
#[repr(u16)]
#[derive(Copy, Clone, PartialEq)]
pub enum Status {
@ -136,6 +137,9 @@ pub struct Response {
length: u64, // Length of payload for command excluding the Response struct
}
// SAFETY: Response contains a series of integers with no implicit padding
unsafe impl ByteValued for Response {}
impl Response {
pub fn new(status: Status, length: u64) -> Self {
Self {
@ -171,8 +175,6 @@ impl Response {
}
}
unsafe impl ByteValued for Response {}
#[repr(C)]
#[derive(Clone, Default, Serialize, Deserialize, Versionize)]
pub struct MemoryRange {