An old project of mine had a function defined, which had a return type of expected<_, error>
. _
used to correlate to Rust unit type ()
, but it seems like it's no longer valid.
What type should I use for Rust's ()
unit type?
Looking at the wit spec, it seems like expected<_, error>
should be valid?
The spec shows:
expected ::= 'expected' '<' expected-ty ',' expected-ty '>'
expected-ty ::= '_'
| ty
Oh it seems like tuple<>
might be the correct approach now
Ari Seyhun has marked this topic as resolved.
With the latest in main
, unit
is now the unit type, so expected<unit, error>
should be used instead.
unit
might be replaced with ()
like in Rust, discussion is here: https://github.com/bytecodealliance/wit-bindgen/issues/217
on a related note, tuple
might also be replaced with (...)
like in Rust, discussion here: https://github.com/bytecodealliance/wit-bindgen/issues/216
Last updated: Nov 22 2024 at 16:03 UTC