Skip to content

Commit

Permalink
Host resources work I guess
Browse files Browse the repository at this point in the history
  • Loading branch information
kajacx committed May 2, 2024
1 parent 559b76f commit b1b049a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/wit_components/resources/guest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl Guest for MyEmployees {
}

fn company_roundtrip(company: Company) -> Company {
company
company_roundtrip_import(company)
}
}

Expand Down
9 changes: 9 additions & 0 deletions tests/wit_components/resources/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ struct State {
companies: ResHolder<MyCompany>,
}

impl ResourcesImports for State {
fn company_roundtrip_import(
&mut self,
company: Resource<Company>,
) -> Result<Resource<Company>> {
Ok(company)
}
}

impl companies::HostCompany for State {
fn new(&mut self, name: String, max_salary: u32) -> Result<Resource<companies::Company>> {
Ok(Resource::new_own(
Expand Down
1 change: 1 addition & 0 deletions tests/wit_components/resources/protocol.wit
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ world resources {
export create-company: func(name: string) -> string;

export company-roundtrip: func(company: company) -> company;
import company-roundtrip-import: func(company: company) -> company;
}

0 comments on commit b1b049a

Please sign in to comment.