pub struct MemoryRefMut<'a>(/* private fields */);Expand description
A borrowed reference to a memory instance
Implementations§
Source§impl MemoryRefMut<'_>
impl MemoryRefMut<'_>
Sourcepub fn load_vec(&self, offset: usize, len: usize) -> Result<Vec<u8>>
pub fn load_vec(&self, offset: usize, len: usize) -> Result<Vec<u8>>
Load a slice of memory as a vector
Sourcepub fn grow(&mut self, delta_pages: i32) -> Option<i32>
pub fn grow(&mut self, delta_pages: i32) -> Option<i32>
Grow the memory by the given number of pages
Sourcepub fn page_count(&mut self) -> usize
pub fn page_count(&mut self) -> usize
Get the current size of the memory in pages
Sourcepub fn copy_within(&mut self, src: usize, dst: usize, len: usize) -> Result<()>
pub fn copy_within(&mut self, src: usize, dst: usize, len: usize) -> Result<()>
Copy a slice of memory to another place in memory
Trait Implementations§
Source§impl<'a> Debug for MemoryRefMut<'a>
impl<'a> Debug for MemoryRefMut<'a>
Source§impl MemoryStringExt for MemoryRefMut<'_>
impl MemoryStringExt for MemoryRefMut<'_>
Source§fn load_cstr(&self, offset: usize, len: usize) -> Result<&CStr>
fn load_cstr(&self, offset: usize, len: usize) -> Result<&CStr>
Load a C-style string from memory
Source§fn load_cstr_until_nul(&self, offset: usize, max_len: usize) -> Result<&CStr>
fn load_cstr_until_nul(&self, offset: usize, max_len: usize) -> Result<&CStr>
Load a C-style string from memory, stopping at the first nul byte
Source§fn load_string(&self, offset: usize, len: usize) -> Result<String>
fn load_string(&self, offset: usize, len: usize) -> Result<String>
Load a UTF-8 string from memory
Source§fn load_cstring(&self, offset: usize, len: usize) -> Result<CString>
fn load_cstring(&self, offset: usize, len: usize) -> Result<CString>
Load a C-style string from memory
Auto Trait Implementations§
impl<'a> Freeze for MemoryRefMut<'a>
impl<'a> RefUnwindSafe for MemoryRefMut<'a>
impl<'a> Send for MemoryRefMut<'a>
impl<'a> Sync for MemoryRefMut<'a>
impl<'a> Unpin for MemoryRefMut<'a>
impl<'a> !UnwindSafe for MemoryRefMut<'a>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.