Constructors can only return the type they are associated with, which matches typical native constructors (e.g. new Thing() in javascript). You can instead use a "static function":
resource mystruct {
make-fallibly: static func(a: u32) -> result<mystruct, my-error>;
}
In rust you would call this like Mystruct::make_fallibly(a).
Yep, that's what I ended up with.
Thanks @Lann Martin :+1:
Bogdan Arabadzhi has marked this topic as resolved.
Last updated: Dec 06 2025 at 05:03 UTC