Skip to content

Commit

Permalink
host_wasmtime: updates for wasmtime api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
yamt committed Apr 22, 2024
1 parent 21873de commit bf70ac3
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions host_wasmtime/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use wasmtime_wasi::preview2::DirPerms;
use wasmtime_wasi::preview2::FilePerms;
use wasmtime_wasi::preview2::Pollable;
use wasmtime_wasi::preview2::Subscribe;
use wasmtime_wasi::preview2::Table;
use wasmtime_wasi::preview2::WasiCtx;
use wasmtime_wasi::preview2::WasiCtxBuilder;
use wasmtime_wasi::preview2::WasiView;
Expand Down Expand Up @@ -45,7 +44,7 @@ wasmtime::component::bindgen!({
});

trait WasiSensorView {
fn table(&mut self) -> &mut Table;
fn table(&mut self) -> &mut ResourceTable;
fn pools(&mut self) -> &mut HashMap<String, Arc<dyn traits::BufferPool + Send + Sync>>;
fn device_groups(
&mut self,
Expand Down Expand Up @@ -280,16 +279,16 @@ impl<T: WasiSensorView> wasi::sensor::property::Host for T {}

struct State {
wasi: WasiCtx,
table: Table,
table: ResourceTable,
pools: HashMap<String, Arc<dyn traits::BufferPool + Send + Sync>>,
device_groups: HashMap<String, Box<dyn traits::SensorDeviceGroup + Send + Sync>>,
}

impl WasiView for State {
fn table(&self) -> &Table {
fn table(&self) -> &ResourceTable {
&self.table
}
fn table_mut(&mut self) -> &mut Table {
fn table_mut(&mut self) -> &mut ResourceTable {
&mut self.table
}
fn ctx(&self) -> &wasmtime_wasi::preview2::WasiCtx {
Expand All @@ -301,7 +300,7 @@ impl WasiView for State {
}

impl WasiSensorView for State {
fn table(&mut self) -> &mut Table {
fn table(&mut self) -> &mut ResourceTable {
&mut self.table
}
fn pools(&mut self) -> &mut HashMap<String, Arc<dyn traits::BufferPool + Send + Sync>> {
Expand Down Expand Up @@ -371,7 +370,7 @@ fn main() -> Result<()> {
&engine,
State {
wasi: wasi_ctx,
table: Table::new(),
table: ResourceTable::new(),
pools: HashMap::new(),
device_groups: device_groups,
},
Expand Down

0 comments on commit bf70ac3

Please sign in to comment.