wasmtime_crypto/
lib.rs

1//! The Wasmtime command line interface (CLI) crate.
2//!
3//! This crate implements the Wasmtime command line tools.
4
5#![deny(
6    missing_docs,
7    trivial_numeric_casts,
8    unused_extern_crates,
9    unstable_features
10)]
11#![warn(unused_import_braces)]
12#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../clippy.toml")))]
13#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
14#![cfg_attr(
15    feature = "cargo-clippy",
16    warn(
17        clippy::float_arithmetic,
18        clippy::mut_mut,
19        clippy::nonminimal_bool,
20        clippy::map_unwrap_or,
21        clippy::unicode_not_nfc,
22        clippy::use_self
23    )
24)]
25
26use once_cell::sync::Lazy;
27use wasmtime_cli_flags::{SUPPORTED_WASI_MODULES, SUPPORTED_WASM_FEATURES};
28
29static FLAG_EXPLANATIONS: Lazy<String> = Lazy::new(|| {
30    use std::fmt::Write;
31
32    let mut s = String::new();
33
34    // Explain --wasm-features.
35    writeln!(&mut s, "Supported values for `--wasm-features`:").unwrap();
36    writeln!(&mut s).unwrap();
37    let max = SUPPORTED_WASM_FEATURES
38        .iter()
39        .max_by_key(|(name, _)| name.len())
40        .unwrap();
41    for (name, desc) in SUPPORTED_WASM_FEATURES.iter() {
42        writeln!(&mut s, "{:width$} {}", name, desc, width = max.0.len() + 2).unwrap();
43    }
44    writeln!(&mut s).unwrap();
45
46    // Explain --wasi-modules.
47    writeln!(&mut s, "Supported values for `--wasi-modules`:").unwrap();
48    writeln!(&mut s).unwrap();
49    let max = SUPPORTED_WASI_MODULES
50        .iter()
51        .max_by_key(|(name, _)| name.len())
52        .unwrap();
53    for (name, desc) in SUPPORTED_WASI_MODULES.iter() {
54        writeln!(&mut s, "{:width$} {}", name, desc, width = max.0.len() + 2).unwrap();
55    }
56
57    writeln!(&mut s).unwrap();
58    writeln!(&mut s, "Features prefixed with '-' will be disabled.").unwrap();
59
60    s
61});
62
63pub mod commands;