Skip to main content

Module prelude

Module prelude 

Source
Expand description

Rust module prelude for Wasmtime crates.

Wasmtime crates that use no_std use core::prelude::* by default which does not include alloc-related functionality such as String and Vec. To have similar ergonomics to std and additionally group up some common functionality this module is intended to be imported at the top of all modules with:

use crate::*;

Externally for crates that depend on wasmtime-environ they should have this in the root of the crate:

use wasmtime_environ::prelude;

and then use crate::* works as usual.

Re-exports§

pub use crate::collections::EntitySet;

Modules§

vec
A contiguous growable array type with heap-allocated contents, written Vec<T>.

Macros§

bail
Early exit from the current function with an error.
ensure
Ensure that a condition holds true, or else early exit from the current function with an error.
format
Creates a String using interpolation of runtime expressions.
format_err
Construct an Error via string formatting or another error.
vec
Creates a Vec containing the arguments.

Structs§

Box
A pointer type that uniquely owns a heap allocation of type T.
Error
Wasmtime’s universal error type.
IndexMap
A hash table where the iteration order of the key-value pairs is independent of the hash values of the keys.
IndexSet
A default set of values.
String
A UTF-8–encoded, growable string.
Vec
A contiguous growable array type, written as Vec<T>, short for ‘vector’.

Traits§

Context
Extension trait to add error context to results.
ToOwned
A generalization of Clone to borrowed data.
ToString
A trait for converting a value to a String.
TryNew
Extension trait providing fallible allocation for types like Arc<T> and Box<T>.

Functions§

try_new
Helper function to invoke <T as TryNew>::try_new.

Type Aliases§

Result
A result of either Ok(T) or an Err(Error).