Add lots of rustdocs and clean up one line of code

This commit is contained in:
Mark McCaskey
2019-09-26 17:15:43 -07:00
parent 287b42579c
commit dc1744560c
10 changed files with 53 additions and 7 deletions

View File

@ -189,6 +189,10 @@ pub fn instantiate(wasm: &[u8], import_object: &ImportObject) -> error::Result<I
}
/// Get a single instance of the default compiler to use.
///
/// The ouptput of this function can be controlled by the mutually
/// exclusive `default-backend-llvm`, `default-backend-singlepass`,
/// and `default-backend-cranelift` feature flags.
pub fn default_compiler() -> impl Compiler {
#[cfg(any(
all(
@ -219,6 +223,11 @@ pub fn default_compiler() -> impl Compiler {
DefaultCompiler::new()
}
/// Get the `Compiler` as a trait object for the given `Backend`.
/// Returns `Option` because support for the `Compiler` may not be enabled by
/// feature flags.
///
/// To get a list of the enabled backends as strings, call `Backend::variants()`
pub fn compiler_for_backend(backend: Backend) -> Option<Box<dyn Compiler>> {
match backend {
#[cfg(feature = "cranelift")]