Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regenerate bindings using wai-bindgen (requires MSRV 1.64) #3389

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 48 additions & 82 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lib/wasi-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
wit-bindgen-rust = { package = "wasmer-wit-bindgen-rust", version = "0.1.1" }
wit-bindgen-rust-wasm = { package = "wasmer-wit-bindgen-gen-rust-wasm", version = "0.1.1" }
wit-bindgen-core = { package = "wasmer-wit-bindgen-gen-core", version = "0.1.1" }
wit-parser = { package = "wasmer-wit-parser", version = "0.1.1" }
wai-bindgen-gen-rust = "0.2.1"
wai-bindgen-gen-rust-wasm = "0.2.1"
wai-bindgen-gen-core = "0.2.1"
wai-parser = "0.2.1"
wasmer-types = { path = "../types", version = "=3.0.2" }
wasmer-derive = { path = "../derive", version = "=3.0.2" }
serde = { version = "1.0", features = ["derive"], optional = true }
Expand Down
9 changes: 7 additions & 2 deletions lib/wasi-types/regenerate.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -xe

BASEDIR=$(dirname "$0")

rm -f \
Expand All @@ -8,8 +10,11 @@ rm -f \

cat "$BASEDIR"/wit-clean/typenames.wit "$BASEDIR"/wit-clean/wasi_unstable.wit > "$BASEDIR"/wit-clean/output.wit

cargo install --force wai-bindgen
git pull origin force-generate-structs
if ! command -v wai-bindgen &>/dev/null; then
echo "Error: wai-bindgen isn't installed."
echo 'Please install it with "cargo install wai-bindgen-cli --version 0.2.2" and try again.'
exit 1
fi

wai-bindgen rust-wasm \
--import "$BASEDIR"/wit-clean/output.wit \
Expand Down
14 changes: 7 additions & 7 deletions lib/wasi-types/src/wasi/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ pub mod output {
}

impl std::error::Error for BusErrno{}
wit_bindgen_rust::bitflags::bitflags! {
wai_bindgen_rust::bitflags::bitflags! {
/// File descriptor rights, determining which actions may be performed.
pub struct Rights: u64 {
/// The right to invoke `fd_datasync`.
Expand Down Expand Up @@ -770,7 +770,7 @@ pub mod output {
}
}
}
wit_bindgen_rust::bitflags::bitflags! {
wai_bindgen_rust::bitflags::bitflags! {
/// File descriptor flags.
pub struct Fdflags: u8 {
/// Append mode: Data written to the file is always appended to the file's end.
Expand Down Expand Up @@ -812,7 +812,7 @@ pub mod output {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("Fdstat").field("fs-filetype", &self.fs_filetype).field("fs-flags", &self.fs_flags).field("fs-rights-base", &self.fs_rights_base).field("fs-rights-inheriting", &self.fs_rights_inheriting).finish()}
}
wit_bindgen_rust::bitflags::bitflags! {
wai_bindgen_rust::bitflags::bitflags! {
/// Which file time attributes to adjust.
/// TODO: wit appears to not have support for flags repr
/// (@witx repr u16)
Expand All @@ -834,7 +834,7 @@ pub mod output {
Self { bits }
}
}
wit_bindgen_rust::bitflags::bitflags! {
wai_bindgen_rust::bitflags::bitflags! {
/// Flags determining the method of how paths are resolved.
/// TODO: wit appears to not have support for flags repr
/// (@witx repr u32)
Expand All @@ -850,7 +850,7 @@ pub mod output {
Self { bits }
}
}
wit_bindgen_rust::bitflags::bitflags! {
wai_bindgen_rust::bitflags::bitflags! {
/// Open flags used by `path_open`.
/// TODO: wit appears to not have support for flags repr
/// (@witx repr u16)
Expand Down Expand Up @@ -904,7 +904,7 @@ pub mod output {
}
}
}
wit_bindgen_rust::bitflags::bitflags! {
wai_bindgen_rust::bitflags::bitflags! {
/// Flags determining how to interpret the timestamp provided in
/// `subscription-clock::timeout`.
pub struct Subclockflags: u8 {
Expand Down Expand Up @@ -977,7 +977,7 @@ pub mod output {
}
}
}
wit_bindgen_rust::bitflags::bitflags! {
wai_bindgen_rust::bitflags::bitflags! {
/// The state of the file descriptor subscribed to with
/// `eventtype::fd_read` or `eventtype::fd_write`.
pub struct Eventrwflags: u8 {
Expand Down
14 changes: 7 additions & 7 deletions lib/wasi-types/src/wasi/extra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ impl core::fmt::Display for BusErrno {
}

impl std::error::Error for BusErrno {}
wit_bindgen_rust::bitflags::bitflags! {
wai_bindgen_rust::bitflags::bitflags! {
/// File descriptor rights, determining which actions may be performed.
pub struct Rights: u64 {
/// The right to invoke `fd_datasync`.
Expand Down Expand Up @@ -749,7 +749,7 @@ impl core::fmt::Debug for Advice {
}
}
}
wit_bindgen_rust::bitflags::bitflags! {
wai_bindgen_rust::bitflags::bitflags! {
/// File descriptor flags.
pub struct Fdflags: u16 {
/// Append mode: Data written to the file is always appended to the file's end.
Expand Down Expand Up @@ -797,7 +797,7 @@ impl core::fmt::Debug for Fdstat {
.finish()
}
}
wit_bindgen_rust::bitflags::bitflags! {
wai_bindgen_rust::bitflags::bitflags! {
/// Which file time attributes to adjust.
/// TODO: wit appears to not have support for flags repr
/// (@witx repr u16)
Expand All @@ -819,7 +819,7 @@ impl Fstflags {
Self { bits }
}
}
wit_bindgen_rust::bitflags::bitflags! {
wai_bindgen_rust::bitflags::bitflags! {
/// Flags determining the method of how paths are resolved.
/// TODO: wit appears to not have support for flags repr
/// (@witx repr u32)
Expand All @@ -835,7 +835,7 @@ impl Lookup {
Self { bits }
}
}
wit_bindgen_rust::bitflags::bitflags! {
wai_bindgen_rust::bitflags::bitflags! {
/// Open flags used by `path_open`.
/// TODO: wit appears to not have support for flags repr
/// (@witx repr u16)
Expand Down Expand Up @@ -883,7 +883,7 @@ impl core::fmt::Debug for Eventtype {
}
}
}
wit_bindgen_rust::bitflags::bitflags! {
wai_bindgen_rust::bitflags::bitflags! {
/// Flags determining how to interpret the timestamp provided in
/// `subscription-clock::timeout`.
pub struct Subclockflags: u16 {
Expand Down Expand Up @@ -967,7 +967,7 @@ impl core::fmt::Debug for Preopentype {
}
}
}
wit_bindgen_rust::bitflags::bitflags! {
wai_bindgen_rust::bitflags::bitflags! {
/// The state of the file descriptor subscribed to with
/// `eventtype::fd_read` or `eventtype::fd_write`.
pub struct Eventrwflags: u16 {
Expand Down