Skip to main content

LibraryModule

Struct LibraryModule 

Source
pub struct LibraryModule<G, const TABLE_SIZE: usize> {
    pub globals: G,
    pub table: Table<TABLE_SIZE>,
}
Expand description

A module that does NOT define its own memory (§4.1).

Operates on borrowed memory from the caller, like a shared library using the host process’s address space. Rust’s borrow checker enforces that the library cannot retain the memory reference beyond a call.

  • G: transpiler-generated globals struct
  • TABLE_SIZE: maximum indirect call table entries

Fields§

§globals: G

Module-level global variables.

§table: Table<TABLE_SIZE>

Indirect call table for call_indirect.

Implementations§

Source§

impl<G, const TABLE_SIZE: usize> LibraryModule<G, TABLE_SIZE>

Source

pub fn new(globals: G, table: Table<TABLE_SIZE>) -> Self

Create a new library module with the given globals and table.

Auto Trait Implementations§

§

impl<G, const TABLE_SIZE: usize> Freeze for LibraryModule<G, TABLE_SIZE>
where G: Freeze,

§

impl<G, const TABLE_SIZE: usize> RefUnwindSafe for LibraryModule<G, TABLE_SIZE>
where G: RefUnwindSafe,

§

impl<G, const TABLE_SIZE: usize> Send for LibraryModule<G, TABLE_SIZE>
where G: Send,

§

impl<G, const TABLE_SIZE: usize> Sync for LibraryModule<G, TABLE_SIZE>
where G: Sync,

§

impl<G, const TABLE_SIZE: usize> Unpin for LibraryModule<G, TABLE_SIZE>
where G: Unpin,

§

impl<G, const TABLE_SIZE: usize> UnsafeUnpin for LibraryModule<G, TABLE_SIZE>
where G: UnsafeUnpin,

§

impl<G, const TABLE_SIZE: usize> UnwindSafe for LibraryModule<G, TABLE_SIZE>
where G: UnwindSafe,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.