Struct tinywasm::MemoryRefMut
source · 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
§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.