Skip to content

Commit

Permalink
Merge pull request #31 from kate-goldenring/latest-cargo-component
Browse files Browse the repository at this point in the history
Update language guide and examples with latest `cargo-component`
  • Loading branch information
kate-goldenring authored Aug 29, 2023
2 parents 43bd196 + 2578449 commit 496af9b
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 233 deletions.
Binary file modified component-model/examples/example-host/add.wasm
100644 → 100755
Binary file not shown.
4 changes: 2 additions & 2 deletions component-model/examples/example-host/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod add_wasi;
mod add;
use clap::Parser;
use std::path::PathBuf;

Expand All @@ -18,7 +18,7 @@ struct AddApp {

impl AddApp {
async fn run(self) -> anyhow::Result<()> {
let sum = add_wasi::add(self.component, self.x, self.y).await?;
let sum = add::add(self.component, self.x, self.y).await?;
println!("{} + {} = {sum}", self.x, self.y);
Ok(())
}
Expand Down
67 changes: 37 additions & 30 deletions component-model/examples/tutorial/adder/Cargo.lock

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

4 changes: 2 additions & 2 deletions component-model/examples/tutorial/adder/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cargo_component_bindings::generate!();
use bindings::exports::docs::calculator::add::Add;
use bindings::exports::docs::calculator::add::Guest;

struct Component;

impl Add for Component {
impl Guest for Component {
fn add(a: u32, b: u32) -> u32 {
a + b
}
Expand Down
Loading

0 comments on commit 496af9b

Please sign in to comment.