wit-bindgen-cli 0.57.1

CLI tool to generate bindings for WIT documents and the component model.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//@ [lang]
//@ path = 'gen/interface/my/test_/i/stub.mbt'

pub async fn read_stream(x : @ffi.StreamReader[Unit]) -> Unit noraise {
      let task = @ffi.current_task()
      let buffer = FixedArray::make(10, Unit::default());

      task.spawn(fn(){
            let _ = x.read(buffer, 1) catch { _ => raise @ffi.Cancelled::Cancelled }
      })
      task.spawn(fn(){
            let _ = x.read(buffer, 2) catch { _ => raise @ffi.Cancelled::Cancelled }
      })
}