diff options
| author | Henry <mail@henrygressmann.de> | 2026-07-24 14:45:52 +0200 |
|---|---|---|
| committer | Henry <mail@henrygressmann.de> | 2026-07-24 14:45:52 +0200 |
| commit | c7c26e8900e86f8b2116648e988b1e34c85f4077 (patch) | |
| tree | ba0a88e0234eef0eb7a3438435256a463770c67a /crates/parser | |
| parent | e96bab075ac8adc13bf96426628c47b66745c70a (diff) | |
docs: improve rust docs
Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'crates/parser')
| -rw-r--r-- | crates/parser/src/lib.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/parser/src/lib.rs b/crates/parser/src/lib.rs index 7936675..aa5e0b0 100644 --- a/crates/parser/src/lib.rs +++ b/crates/parser/src/lib.rs @@ -49,7 +49,10 @@ pub use tinywasm_types::Module; #[non_exhaustive] #[derive(Debug, Clone)] pub struct ParserOptions { - /// Whether to validate modules while parsing. + /// Whether to validate modules while parsing. Enabled by default. + /// + /// Disable this only for trusted input. Parsing without validation may produce + /// a module that violates runtime assumptions. pub validation: bool, /// Whether to optimize local memory allocation by skipping allocation of unused local memories. pub optimize_local_memory_allocation: bool, @@ -81,6 +84,9 @@ impl Default for ParserOptions { impl ParserOptions { /// Enable or disable WebAssembly validation. + /// + /// Disable this only for trusted input. Parsing without validation may produce + /// a module that violates runtime assumptions. pub const fn with_validation(mut self, enabled: bool) -> Self { self.validation = enabled; self @@ -337,7 +343,7 @@ pub fn parse_file(path: impl AsRef<crate::std::path::Path> + Clone) -> Result<Mo } #[cfg(feature = "std")] -/// Parse a module from a stream. Requires `parser` and `std` features. +/// Parse a module from a stream. Requires the `std` feature. pub fn parse_stream(stream: impl crate::std::io::Read) -> Result<Module> { Parser::new().parse_module_stream(stream) } |
