Skip to main content

MemoryRequest

Struct MemoryRequest 

Source
pub struct MemoryRequest<'a> { /* private fields */ }
Available on crate feature runtime only.
Expand description

A request to a MemoryCreator::new_memory.

Implementations§

Source§

impl<'a> MemoryRequest<'a>

Source

pub fn ty(&self) -> MemoryType

The type of memory being created. Indicates both the minimum and maximum size, in wasm pages. The minimum and maximum sizes, in bytes, are also specified as minimum and maximum to avoid integer conversion if desired.

Source

pub fn minimum(&self) -> usize

Minimum size of the memory in bytes. Same as the minimum of ty, but in bytes.

Source

pub fn maximum(&self) -> Option<usize>

Limit on the maximum size of the memory in bytes, if any. Same as the maximum of ty, but in bytes.

Source

pub fn reserved_size_in_bytes(&self) -> usize

Indicates the expected size of the reservation that is to be made for this memory. The implementation must reserve this many bytes for the memory’s allocation, plus the guard size at the end. Note that this reservation need only be a virtual memory reservation, physical memory does not need to be allocated immediately.

If this value is not zero, grow_to should never move the base pointer and the maximum size of ty is guaranteed to fit within reserved_size_in_bytes.

This value is tuned from the various Config methods about memory sizes/guards. It is guaranteed to be a multiple of the system page size.

Source

pub fn guard_size_in_bytes(&self) -> usize

Indicates how many bytes of space after the memory allocation is expected to be unmapped. JIT code will elide bounds checks based on the guard_size_in_bytes provided, so for JIT code to work correctly the memory returned will need to be properly guarded with guard_size_in_bytes bytes left unmapped after the base allocation.

This value is tuned from the various Config methods about memory sizes/guards. It is guaranteed to be a multiple of the system page size.

Source

pub fn kind(&self) -> MemoryKind

What kind of memory is requested.

Trait Implementations§

Source§

impl Debug for MemoryRequest<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for MemoryRequest<'a>

§

impl<'a> RefUnwindSafe for MemoryRequest<'a>

§

impl<'a> Send for MemoryRequest<'a>

§

impl<'a> Sync for MemoryRequest<'a>

§

impl<'a> Unpin for MemoryRequest<'a>

§

impl<'a> UnsafeUnpin for MemoryRequest<'a>

§

impl<'a> UnwindSafe for MemoryRequest<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.