pub struct ReadonlySharedMemory { /* private fields */ }Expand description
A ReadonlySharedMemory is a different kind of shared memory, separate from the exclusive/host/guest lifecycle, used to represent read-only mappings of snapshot pages into the guest efficiently.
Trait Implementations§
Source§fn clone(&self) -> ReadonlySharedMemory
fn clone(&self) -> ReadonlySharedMemory
Returns a duplicate 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§fn region(&self) -> &HostMapping
fn region(&self) -> &HostMapping
Return a readonly reference to the host mapping backing this SharedMemory
Source§fn with_exclusivity<T, F: FnOnce(&mut ExclusiveSharedMemory) -> T>(
&mut self,
_: F,
) -> Result<T>
fn with_exclusivity<T, F: FnOnce(&mut ExclusiveSharedMemory) -> T>( &mut self, _: F, ) -> Result<T>
Run some code with exclusive access to the SharedMemory
underlying this. If the SharedMemory is not an
ExclusiveSharedMemory, any concurrent accesses to the relevant
HostSharedMemory/GuestSharedMemory may make this fail, or be
made to fail by this, and should be avoided.
Source§fn with_contents<T, F: FnOnce(&[u8]) -> T>(&mut self, f: F) -> Result<T>
fn with_contents<T, F: FnOnce(&[u8]) -> T>(&mut self, f: F) -> Result<T>
Run some code that is allowed to access the contents of the
SharedMemory as if it is a normal slice. By default, this is
implemented via
SharedMemory::with_exclusivity, which is
the correct implementation for a memory that can be mutated,
but a ReadonlySharedMemory, can support this.Source§fn base_addr(&self) -> usize
fn base_addr(&self) -> usize
Return the base address of the host mapping of this
region. Following the general Rust philosophy, this does not
need to be marked as
unsafe because doing anything with this
pointer itself requires unsafe.Source§fn base_ptr(&self) -> *mut u8
fn base_ptr(&self) -> *mut u8
Return the base address of the host mapping of this region as
a pointer. Following the general Rust philosophy, this does
not need to be marked as
unsafe because doing anything with
this pointer itself requires unsafe.Source§fn mem_size(&self) -> usize
fn mem_size(&self) -> usize
Return the length of usable memory contained in
self.
The returned size does not include the size of the surrounding
guard pages.Source§fn raw_ptr(&self) -> *mut u8
fn raw_ptr(&self) -> *mut u8
Return the raw base address of the host mapping, including the
guard pages.
Source§fn raw_mem_size(&self) -> usize
fn raw_mem_size(&self) -> usize
Return the raw size of the host mapping, including the guard
pages.
Source§fn host_region_base(
&self,
) -> <HostGuestMemoryRegion as MemoryRegionKind>::HostBaseType
fn host_region_base( &self, ) -> <HostGuestMemoryRegion as MemoryRegionKind>::HostBaseType
Extract a base address that can be mapped into a VM for this
SharedMemory. Read more
Source§fn host_region_end(
&self,
) -> <HostGuestMemoryRegion as MemoryRegionKind>::HostBaseType
fn host_region_end( &self, ) -> <HostGuestMemoryRegion as MemoryRegionKind>::HostBaseType
Return the end address of the host region (base + usable size).
Auto Trait Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<Ctx, T> MeasureWith<Ctx> for T
impl<Ctx, T> MeasureWith<Ctx> for T
Source§fn measure_with(&self, _ctx: &Ctx) -> usize
fn measure_with(&self, _ctx: &Ctx) -> usize
How large is
Self, given the ctx?