Struct InstancePre
pub struct InstancePre<T> { /* private fields */ }
Expand description
An instance, pre-instantiation, that is ready to be instantiated.
This structure represents an instance just before it was instantiated, after all type-checking and imports have been resolved. The only thing left to do for this instance is to actually run the process of instantiation.
Note that an InstancePre
may not be tied to any particular Store
if
none of the imports it closed over are tied to any particular Store
.
This structure is created through the Linker::instantiate_pre
method,
which also has some more information and examples.
Implementations§
§impl<T> InstancePre<T>
impl<T> InstancePre<T>
pub fn module(&self) -> &Module
pub fn module(&self) -> &Module
Returns a reference to the module that this InstancePre
will be
instantiating.
pub fn instantiate(
&self,
store: impl AsContextMut<Data = T>,
) -> Result<Instance, Error>
pub fn instantiate( &self, store: impl AsContextMut<Data = T>, ) -> Result<Instance, Error>
Instantiates this instance, creating a new instance within the provided
store
.
This function will run the actual process of instantiation to completion. This will use all of the previously-closed-over items as imports to instantiate the module that this was originally created with.
For more information about instantiation see Instance::new
.
§Panics
Panics if any import closed over by this InstancePre
isn’t owned by
store
, or if store
has async support enabled. Additionally this
function will panic if the store
provided comes from a different
Engine
than the InstancePre
originally came from.
pub async fn instantiate_async(
&self,
store: impl AsContextMut<Data = T>,
) -> Result<Instance, Error>where
T: Send,
pub async fn instantiate_async(
&self,
store: impl AsContextMut<Data = T>,
) -> Result<Instance, Error>where
T: Send,
Creates a new instance, running the start function asynchronously instead of inline.
For more information about asynchronous instantiation see the
documentation on Instance::new_async
.
§Panics
Panics if any import closed over by this InstancePre
isn’t owned by
store
, or if store
does not have async support enabled.
Trait Implementations§
§impl<T> Clone for InstancePre<T>
impl<T> Clone for InstancePre<T>
InstancePre’s clone does not require T: Clone
§fn clone(&self) -> InstancePre<T>
fn clone(&self) -> InstancePre<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<T> Freeze for InstancePre<T>
impl<T> !RefUnwindSafe for InstancePre<T>
impl<T> Send for InstancePre<T>
impl<T> Sync for InstancePre<T>
impl<T> Unpin for InstancePre<T>
impl<T> !UnwindSafe for InstancePre<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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