logo
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

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

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 the type of this memory.

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

Returns the size, in bytes, of this memory.

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.

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 WebAssembly memory by 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 the Memory.

Arguments
  • offset - The data start offset in the Memory.

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

Errors

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

Returns the data pointer to the Memory.

Arguments
  • offset - The data start offset in the Memory.

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

Errors

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

Trait Implementations

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 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.