From b1b049a2b90cc9bb29f89d29fa564a514de41f95 Mon Sep 17 00:00:00 2001 From: kajacx Date: Thu, 2 May 2024 13:16:42 +0200 Subject: [PATCH] Host resources work I guess --- tests/wit_components/resources/guest.rs | 2 +- tests/wit_components/resources/host.rs | 9 +++++++++ tests/wit_components/resources/protocol.wit | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/wit_components/resources/guest.rs b/tests/wit_components/resources/guest.rs index 1f008ad..d3e7ed2 100644 --- a/tests/wit_components/resources/guest.rs +++ b/tests/wit_components/resources/guest.rs @@ -12,7 +12,7 @@ impl Guest for MyEmployees { } fn company_roundtrip(company: Company) -> Company { - company + company_roundtrip_import(company) } } diff --git a/tests/wit_components/resources/host.rs b/tests/wit_components/resources/host.rs index fd0e9a1..e9a7362 100644 --- a/tests/wit_components/resources/host.rs +++ b/tests/wit_components/resources/host.rs @@ -44,6 +44,15 @@ struct State { companies: ResHolder, } +impl ResourcesImports for State { + fn company_roundtrip_import( + &mut self, + company: Resource, + ) -> Result> { + Ok(company) + } +} + impl companies::HostCompany for State { fn new(&mut self, name: String, max_salary: u32) -> Result> { Ok(Resource::new_own( diff --git a/tests/wit_components/resources/protocol.wit b/tests/wit_components/resources/protocol.wit index 7b54bc7..74abe6d 100644 --- a/tests/wit_components/resources/protocol.wit +++ b/tests/wit_components/resources/protocol.wit @@ -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; }