Skip to content

Commit 08a9bc6

Browse files
committed
[chapter 04] addressing second peer review
Signed-off-by: danbugs <danilochiarlone@gmail.com>
1 parent 8224c8f commit 08a9bc6

File tree

41 files changed

+328
-654
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+328
-654
lines changed

Cargo.lock

Lines changed: 58 additions & 476 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chapter02/hello_world/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cargo build --target wasm32-unknown-unknown --release
1111

1212
```bash
1313
# from the `hello_world_guest/` directory
14-
docker run --rm -v "$(pwd):/data" danstaken/hello_world_host:latest /data/hello_world_guest.wasm 'Dan'
14+
docker run --rm -v "$(pwd):/data" ghcr.io/danbugs/serverside-wasm-book-code/hello-world-host:latest /data/hello_world_guest.wasm 'Dan'
1515
```
1616

1717
You can also run locally, with:
@@ -24,5 +24,5 @@ cargo run -- ../hello_world_guest/hello_world_guest.wasm 'Dan'
2424
## Toolchain versions
2525

2626
```bash
27-
rustc 1.85.0 (4d91de4e4 2025-02-17)
27+
rustc 1.84.0 (9fc6b4312 2025-01-07)
2828
```
-254 Bytes
Binary file not shown.

chapter04/composability/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## How to compose two Wasm components together?
44

55
```bash
6-
wac plug <path-to>/composability_bin.wasm --plug <path-to>/composability_lib.wasm -o composability.wasm
6+
wac plug ../composability_bin.wasm --plug <path-to>/composability_lib.wasm -o composability.wasm
77
```
88

99
## How to run?
151 KB
Binary file not shown.

chapter04/composability/composability_bin/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
wit-bindgen-rt = { version = "0.28.0", features = ["bitflags"] }
7+
wit-bindgen-rt = { version = "0.41.0", features = ["bitflags"] }
88

99
[profile.release]
1010
codegen-units = 1
@@ -16,8 +16,8 @@ lto = true
1616
[package.metadata.component]
1717
package = "composability:bin"
1818

19+
[package.metadata.component.dependencies]
20+
1921
[package.metadata.component.target]
2022
path = "../wit/bin.wit"
21-
world = "bin"
22-
23-
[package.metadata.component.dependencies]
23+
world = "bin"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# `hello_world_wasi02`
2+
3+
## How to re-create this example?
4+
5+
```bash
6+
cargo component new --bin hello_world_wasi02
7+
```
8+
9+
## How to run?
10+
11+
```bash
12+
wasmtime ../../target/wasm32-wasip1/release/hello_world_wasi02.wasm
13+
Hello, world!
14+
```
15+
16+
## Toolchain Versions
17+
18+
```bash
19+
cargo-component-component 0.14.0 (wasi:95fee6f)
20+
wasm-tools 1.227.1
21+
wasmtime 30.0.0
22+
```
23+

chapter04/composability/composability_bin/src/bindings.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Generated by `wit-bindgen` 0.25.0. DO NOT EDIT!
2+
// Options used:
13
#[allow(unused_unsafe, clippy::all)]
24
pub fn hello_world() -> _rt::String {
35
unsafe {
@@ -11,6 +13,7 @@ pub fn hello_world() -> _rt::String {
1113
#[link_name = "hello-world"]
1214
fn wit_import(_: *mut u8);
1315
}
16+
1417
#[cfg(not(target_arch = "wasm32"))]
1518
fn wit_import(_: *mut u8) {
1619
unreachable!()
@@ -35,16 +38,19 @@ mod _rt {
3538
}
3639
extern crate alloc as alloc_crate;
3740
}
41+
3842
#[cfg(target_arch = "wasm32")]
39-
#[link_section = "component-type:wit-bindgen:0.30.0:bin:encoded world"]
43+
#[link_section = "component-type:wit-bindgen:0.25.0:bin:encoded world"]
4044
#[doc(hidden)]
4145
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 174] = *b"\
4246
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x075\x01A\x02\x01A\x02\x01\
4347
@\0\0s\x03\0\x0bhello-world\x01\0\x04\x01\x15composability:bin/bin\x04\0\x0b\x09\
4448
\x01\0\x03bin\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x07\
45-
0.215.0\x10wit-bindgen-rust\x060.30.0";
49+
0.208.1\x10wit-bindgen-rust\x060.25.0";
50+
4651
#[inline(never)]
4752
#[doc(hidden)]
53+
#[cfg(target_arch = "wasm32")]
4854
pub fn __link_custom_section_describing_imports() {
4955
wit_bindgen_rt::maybe_link_cabi_realloc();
5056
}

chapter04/composability/composability_bin/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ use bindings::hello_world;
55

66
fn main() {
77
println!("{}", hello_world());
8-
}
8+
}

chapter04/composability/composability_lib/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
wit-bindgen-rt = { version = "0.28.0", features = ["bitflags"] }
7+
wit-bindgen-rt = { version = "0.41.0", features = ["bitflags"] }
88

99
[lib]
1010
crate-type = ["cdylib"]
@@ -19,8 +19,8 @@ lto = true
1919
[package.metadata.component]
2020
package = "composability:lib"
2121

22+
[package.metadata.component.dependencies]
23+
2224
[package.metadata.component.target]
2325
path = "../wit/lib.wit"
2426
world = "lib"
25-
26-
[package.metadata.component.dependencies]

0 commit comments

Comments
 (0)