1- use anyhow:: { Context as _ , Result , anyhow, bail} ;
1+ use anyhow:: { Result , anyhow, bail} ;
22use futures:: { StreamExt as _, stream} ;
33use log:: { debug, info} ;
44use std:: {
@@ -10,11 +10,9 @@ use wasmtime::{
1010 Engine , Store ,
1111 component:: { Component , Linker } ,
1212} ;
13- use wasmtime_wasi:: { DirPerms , FilePerms , I32Exit , ResourceTable } ;
13+ use wasmtime_wasi:: { DirPerms , FilePerms , I32Exit , ResourceTable , WasiCtx , WasiCtxView , WasiView } ;
1414
15- use wasmtime_wasi:: p2:: {
16- IoView , WasiCtx , WasiCtxBuilder , WasiView , bindings:: Command , pipe:: MemoryOutputPipe ,
17- } ;
15+ use wasmtime_wasi:: p2:: { bindings:: Command , pipe:: MemoryOutputPipe } ;
1816
1917use crate :: {
2018 config:: { ConfigLinter , LinterLocation } ,
@@ -58,14 +56,11 @@ struct ComponentRunStates {
5856}
5957
6058impl WasiView for ComponentRunStates {
61- fn ctx ( & mut self ) -> & mut WasiCtx {
62- & mut self . wasi_ctx
63- }
64- }
65-
66- impl IoView for ComponentRunStates {
67- fn table ( & mut self ) -> & mut ResourceTable {
68- & mut self . resource_table
59+ fn ctx ( & mut self ) -> WasiCtxView < ' _ > {
60+ WasiCtxView {
61+ ctx : & mut self . wasi_ctx ,
62+ table : & mut self . resource_table ,
63+ }
6964 }
7065}
7166
@@ -122,8 +117,7 @@ pub async fn run_single_linter(
122117
123118 info ! ( "Loading component" ) ;
124119
125- let engine =
126- Engine :: new ( wasmtime:: Config :: new ( ) . async_support ( true ) ) . context ( "creating WASM engine" ) ?;
120+ let engine = Engine :: new ( & wasmtime:: Config :: new ( ) ) ?;
127121
128122 let component = wasi_cache:: load_component_cached ( & engine, & linter_path) . await ?;
129123
@@ -195,7 +189,7 @@ async fn run_linter_command(
195189 let stdout = MemoryOutputPipe :: new ( 10 * 1024 * 1024 ) ;
196190 let stderr = MemoryOutputPipe :: new ( 10 * 1024 * 1024 ) ;
197191
198- let wasi = WasiCtxBuilder :: new ( )
192+ let wasi = WasiCtx :: builder ( )
199193 . allow_tcp ( false )
200194 . allow_udp ( false )
201195 . allow_ip_name_lookup ( false )
@@ -238,7 +232,7 @@ async fn run_linter_command(
238232 return Ok ( false ) ;
239233 }
240234 } else {
241- return Err ( error) ;
235+ return Err ( error. into ( ) ) ;
242236 }
243237 }
244238 } ;
0 commit comments