Skip to content

Commit 2933c35

Browse files
committed
Implement ModuleConfig in verifyimports
1 parent 858da62 commit 2933c35

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

libchisel/src/verifyimports.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
use std::collections::HashMap;
2+
13
use parity_wasm::elements::{External, FunctionType, ImportSection, Module, Type};
24

35
use super::{
46
imports::{ImportList, ImportType},
5-
ChiselModule, ModuleError, ModuleKind, ModulePreset, ModuleValidator,
7+
ChiselModule, ModuleConfig, ModuleError, ModuleKind, ModulePreset, ModuleValidator,
68
};
79

810
/// Enum representing the state of an import in a module.
@@ -51,6 +53,20 @@ impl<'a> ChiselModule<'a> for VerifyImports<'a> {
5153
}
5254
}
5355

56+
impl<'a> ModuleConfig for VerifyImports<'a> {
57+
fn with_defaults() -> Result<Self, ModuleError> {
58+
Err(ModuleError::NotSupported)
59+
}
60+
61+
fn with_config(config: &HashMap<String, String>) -> Result<Self, ModuleError> {
62+
if let Some(preset) = config.get("preset") {
63+
VerifyImports::with_preset(preset)
64+
} else {
65+
Err(ModuleError::NotSupported)
66+
}
67+
}
68+
}
69+
5470
impl<'a> ModulePreset for VerifyImports<'a> {
5571
fn with_preset(preset: &str) -> Result<Self, ModuleError> {
5672
let mut import_set = ImportList::new();

0 commit comments

Comments
 (0)