Skip to content

Commit a8c4fdd

Browse files
author
Peter Huene
authored
wasm-compose: update example for latest cargo-component. (#802)
This commit updates the `wasm-compose` example given the latest cargo-component, which itself is based off of the latest out of wasm-tools and wit-bindgen. The server in the example needed to update to a more recent wasmtime as a result (specifically, one that supports type exports from component/instance types).
1 parent 2783d58 commit a8c4fdd

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

crates/wasm-compose/example/middleware/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ wit-bindgen-guest-rust = { git = "https://github.com/bytecodealliance/wit-bindge
1212
crate-type = ["cdylib"]
1313

1414
[package.metadata.component]
15-
direct-interface-export = "service"
15+
direct-export = "service"
1616

1717
[package.metadata.component.imports]
1818
backend = "../service.wit"

crates/wasm-compose/example/middleware/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
use bindings::{
2+
backend,
3+
service::{Error, Request, Response, Service},
4+
};
15
use flate2::{write::GzEncoder, Compression};
2-
use service::{Error, Request, Response, Service};
36
use std::io::Write;
47

58
struct Component;
@@ -50,4 +53,4 @@ impl Service for Component {
5053
}
5154
}
5255

53-
service::export!(Component);
56+
bindings::export!(Component);

crates/wasm-compose/example/server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ async-std = { version = "1.12.0", features = ["attributes"] }
99
clap = { version = "3.2.16", features = ["derive"] }
1010
driftwood = "0.0.6"
1111
tide = "0.16.0"
12-
wasmtime = { version = "2.0.0", features = ["component-model"] }
12+
wasmtime = { git = "https://github.com/bytecodealliance/wasmtime", rev = "b61e678", features = ["component-model"] }
1313

1414
[workspace]

crates/wasm-compose/example/service/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ wit-bindgen-guest-rust = { git = "https://github.com/bytecodealliance/wit-bindge
1111
crate-type = ["cdylib"]
1212

1313
[package.metadata.component]
14-
direct-interface-export = "service"
14+
direct-export = "service"
1515

1616
[package.metadata.component.exports]
1717
service = "../service.wit"

crates/wasm-compose/example/service/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use service::{Error, Request, Response, Service};
1+
use bindings::service::{Error, Request, Response, Service};
22
use std::str;
33

44
struct Component;
@@ -27,4 +27,4 @@ impl Service for Component {
2727
}
2828
}
2929

30-
service::export!(Component);
30+
bindings::export!(Component);

0 commit comments

Comments
 (0)