LinkerBuilder

Struct LinkerBuilder 

Source
pub struct LinkerBuilder<State, T> { /* private fields */ }
๐Ÿ‘ŽDeprecated since 0.49.0: use Linker or Instance::new instead
Expand description

A linker used to define module imports and instantiate module instances.

Create this type via the Linker::build method.

Implementationsยง

Sourceยง

impl<T> LinkerBuilder<Ready, T>

Source

pub fn create(&self, engine: &Engine) -> Linker<T>

Finishes construction of the Linker by attaching an Engine.

Sourceยง

impl<T> LinkerBuilder<Constructing, T>

Source

pub fn finish(self) -> LinkerBuilder<Ready, T>

Signals that the LinkerBuilder is now ready to create new Linker instances.

Source

pub fn func_new( &mut self, module: &str, name: &str, ty: FuncType, func: impl Fn(Caller<'_, T>, &[Val], &mut [Val]) -> Result<(), Error> + Send + Sync + 'static, ) -> Result<&mut Self, LinkerError>

Creates a new named Func::new-style host Func for this Linker.

For more information see Linker::func_wrap.

ยงErrors

If there already is a definition under the same name for this Linker.

ยงPanics

If the LinkerBuilder has already created a Linker using LinkerBuilder::finish.

Source

pub fn func_wrap<Params, Args>( &mut self, module: &str, name: &str, func: impl IntoFunc<T, Params, Args>, ) -> Result<&mut Self, LinkerError>

Creates a new named Func::new-style host Func for this Linker.

For information how to use this API see Func::wrap.

This method creates a host function for this Linker under the given name. It is distinct in its ability to create a Store independent host function. Host functions defined this way can be used to instantiate instances in multiple different Store entities.

The same applies to other Linker methods to define new Func instances such as Linker::func_new.

In a concurrently running program, this means that these host functions could be called concurrently if different Store entities are executing on different threads.

ยงErrors

If there already is a definition under the same name for this Linker.

ยงPanics

If the LinkerBuilder has already created a Linker using LinkerBuilder::finish.

Trait Implementationsยง

Sourceยง

impl<T> Clone for LinkerBuilder<Ready, T>

Sourceยง

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl<State: Debug, T: Debug> Debug for LinkerBuilder<State, T>

Sourceยง

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

Formats the value using the given formatter. Read more

Auto Trait Implementationsยง

ยง

impl<State, T> Freeze for LinkerBuilder<State, T>

ยง

impl<State, T> !RefUnwindSafe for LinkerBuilder<State, T>

ยง

impl<State, T> Send for LinkerBuilder<State, T>

ยง

impl<State, T> Sync for LinkerBuilder<State, T>

ยง

impl<State, T> Unpin for LinkerBuilder<State, T>

ยง

impl<State, T> !UnwindSafe for LinkerBuilder<State, T>

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> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.