[−][src]Trait lucet_runtime::Region
A memory region in which Lucet instances are created and run.
These methods return an InstanceHandle
smart pointer rather than
the Instance
itself. This allows the region implementation complete control of where the
instance metadata is stored.
Required methods
fn free_slots(&self) -> usize
Return the number of instance slots that are currently free in the region.
A value greater than zero does not guarantee that a subsequent call to
Region::new_instance()
will succeed, as other threads may instantiate from the region in
the meantime.
fn used_slots(&self) -> usize
Return the number of instance slots that are currently in use in the region.
A value less than self.capacity()
does not guarantee that a subsequent call to
Region::new_instance()
will succeed, as other threads may instantiate from the region in
the meantime.
fn capacity(&self) -> usize
Return the total instance slot capacity of the region.
Provided methods
fn new_instance(
&self,
module: Arc<dyn Module + 'static>
) -> Result<InstanceHandle, Error>
&self,
module: Arc<dyn Module + 'static>
) -> Result<InstanceHandle, Error>
Create a new instance within the region.
Calling region.new_instance(module)
is shorthand for
region.new_instance_builder(module).build()
for use when further customization is
unnecessary.
Safety
This function runs the guest code for the WebAssembly start
section, and running any guest
code is potentially unsafe; see Instance::run()
.
fn new_instance_builder(
&'a self,
module: Arc<dyn Module + 'static>
) -> InstanceBuilder<'a>
&'a self,
module: Arc<dyn Module + 'static>
) -> InstanceBuilder<'a>
Return an InstanceBuilder
for the given module.