Stream: general

Topic: WIT: Failable constructor?


view this post on Zulip Bogdan Arabadzhi (May 08 2025 at 09:59):

Hey, I'm pretty new to wasip2 and WIT.
Trying to create a WIT file for Rust library.
The problem is that failable constructor doesn't work with wit-bindgen:

resource mystruct {
    constructor(a: u32) -> result<mystruct, my-error>;
}

Any standard way to express it in WIT?

view this post on Zulip Bogdan Arabadzhi (May 08 2025 at 12:39):

Another one: option<T> is not allowed in constructors?


Last updated: Jan 10 2026 at 02:36 UTC