forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Roman Volosatovs <[email protected]>
- Loading branch information
1 parent
5d6cd8c
commit 815b81a
Showing
111 changed files
with
641 additions
and
612 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ make_vendor() { | |
|
||
cache_dir=$(mktemp -d) | ||
|
||
make_vendor "wasi" " | ||
make_vendor "wasi/src/p2" " | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
|
@@ -45,7 +45,7 @@ make_vendor "wasi" " | |
[email protected] | ||
" | ||
|
||
make_vendor "wasi-http" " | ||
make_vendor "wasi-http/src/p2" " | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
|
@@ -55,9 +55,9 @@ make_vendor "wasi-http" " | |
[email protected] | ||
" | ||
|
||
make_vendor "wasi-config" "config@f4d699b" | ||
make_vendor "wasi-config/src/p2" "config@f4d699b" | ||
|
||
make_vendor "wasi-keyvalue" "keyvalue@219ea36" | ||
make_vendor "wasi-keyvalue/src/p2" "keyvalue@219ea36" | ||
|
||
rm -rf $cache_dir | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//! Implementation of wasip2 version of `wasi:config` package | ||
mod gen_ { | ||
wasmtime::component::bindgen!({ | ||
path: "src/p2/wit", | ||
world: "wasi:config/imports", | ||
trappable_imports: true, | ||
}); | ||
} | ||
use self::gen_::wasi::config::store as generated; | ||
|
||
use crate::WasiConfig; | ||
|
||
impl generated::Host for WasiConfig<'_> { | ||
fn get(&mut self, key: String) -> anyhow::Result<Result<Option<String>, generated::Error>> { | ||
Ok(Ok(self.vars.0.get(&key).map(|s| s.to_owned()))) | ||
} | ||
|
||
fn get_all(&mut self) -> anyhow::Result<Result<Vec<(String, String)>, generated::Error>> { | ||
Ok(Ok(self | ||
.vars | ||
.0 | ||
.iter() | ||
.map(|(k, v)| (k.to_string(), v.to_string())) | ||
.collect())) | ||
} | ||
} | ||
|
||
/// Add all the `wasi-config` world's interfaces to a [`wasmtime::component::Linker`]. | ||
pub fn add_to_linker<T>( | ||
l: &mut wasmtime::component::Linker<T>, | ||
f: impl Fn(&mut T) -> WasiConfig<'_> + Send + Sync + Copy + 'static, | ||
) -> anyhow::Result<()> { | ||
generated::add_to_linker_get_host(l, f)?; | ||
Ok(()) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.