Struct wasmedge_sdk::Memory

source ·
pub struct Memory { /* private fields */ }
Expand description

Defines a linear memory.

Implementations§

Creates a new wasm memory instance with the given type.

Argument
  • ty - The type of the memory instance to be created.
Error

Returns the exported name of this memory.

Notice that this field is meaningful only if this memory is used as an exported instance.

Returns the name of the module instance from which this memory exports.

Notice that this field is meaningful only if this memory is used as an exported instance.

Returns a reference to the type of this memory.

Returns the size, in WebAssembly pages (64 KiB of each page), of this wasm memory.

Returns the byte length of this memory. The returned value will be a multiple of the wasm page size, 64k.

Safely reads memory contents at the given offset into a buffer.

Arguments
  • offset - The offset from which to read.

  • len - the length of bytes to read.

Error

If fail to read the memory, then an error is returned.

Returns a string of byte length len from this memory, starting at offset.

Arguments
  • offset - The offset from which to read.

  • len - the length of bytes to read.

Error

If fail to read, then an error is returned.

Safely writes contents of a buffer to this memory at the given offset.

Arguments
  • data - The bytes to write to this memory..

  • offset - The offset at which to write.

Error

If fail to write to the memory, then an error is returned.

Grows this memory by the count pages.

Argument
  • count - The number of pages to grow the memory by.
Error

If fail to grow the memory, then an error is returned.

Returns the const data pointer to this memory.

Arguments
  • offset - The data start offset in this memory.

  • len - The requested data length. If the size of offset + len is larger than the data size in this memory.

Errors

If fail to get the data pointer, then an error is returned.

Returns the data pointer to this memory.

Arguments
  • offset - The data start offset in this memory.

  • len - The requested data length. If the size of offset + len is larger than the data size in this memory.

Errors

If fail to get the data pointer, then an error is returned.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.