Guest-side MoonBit SDK for calling Posoco host capabilities from a program
import {
"posoco/ears@0.1.0" @ears,
"moonbitlang/async",
}
async fn main {
@ears.serve(
wire=@ears.stdio(),
run=(ears, input) => {
let outcome = ears.call("read", { "path": "README.md" })
if outcome.is_error {
fail("ears: read failed")
}
{ "echo": input }
},
)
}pub(open) trait Wire {
async fn send(Self, frame : String) -> Unit
async fn receive(Self) -> String?
}pub struct Ears {
// private fields
}pub struct StdioWire {
}Install
Download zipGuest-side MoonBit SDK for calling Posoco host capabilities from a program