forked from bytecodealliance/ComponentizeJS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwit.rs
More file actions
23 lines (19 loc) · 650 Bytes
/
wit.rs
File metadata and controls
23 lines (19 loc) · 650 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use anyhow::{Result, bail};
wit_bindgen::generate!({
world: "spidermonkey-embedding-splicer",
pub_export_macro: true
});
use crate::wit::exports::local::spidermonkey_embedding_splicer::splicer::Feature;
impl std::str::FromStr for Feature {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self> {
match s {
"stdio" => Ok(Feature::Stdio),
"clocks" => Ok(Feature::Clocks),
"random" => Ok(Feature::Random),
"http" => Ok(Feature::Http),
"fetch-event" => Ok(Feature::FetchEvent),
_ => bail!("unrecognized feature string [{s}]"),
}
}
}