Struct kvm_rs::UserMem [−][src]
Wrapper to safely allocate memory for guest VMs.
The underlying memory is freed automatically once the UserMem
instance is dropped.
Memory can be mapped into a guest VM with
Vm::set_user_memory_region
.
Implementations
impl UserMem
[src]
pub fn new(len: usize) -> Result<UserMem>
[src]
Allocate a zero-initialized memory region of len
bytes.
pub fn with_init(len: usize, init_from: &[u8]) -> Result<UserMem>
[src]
Allocate a zero-initialized memory region of len
bytes and initialize the first bytes
with init_from
.
Panics
Panics if init_from
is larger than the memory size len
.
pub fn load(&mut self, addr: PhysAddr, data: &[u8])
[src]
Load the bytes stored in data
into memory at physical address addr
.
Panics
Panics if addr + data.len
is larger than the memory size len
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for UserMem
impl !Send for UserMem
impl !Sync for UserMem
impl Unpin for UserMem
impl UnwindSafe for UserMem
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,