How to define usize
type in a .wit
file. If instead of usize
, I type in u64
it works. But want to know if there is a type of max unsigned integer that matches with usize
.
get-size: func() -> result<usize, type-error>;
Error
0: failed to resolve directory while parsing WIT for path [./wit]
1: failed to parse package: ./wit
2: name `usize` is not defined
--> ./wit/a.wit:52:42
|
52 | get-size: func() -> result<usize, type-error>;
|
How to define usize
type in a .wit
file. If instead of usize
, I type in u64
it works. But want to know if there is a type of max unsigned integer that matches with usize
.
get-size: func() -> result<usize, type-error>;
Error
0: failed to resolve directory while parsing WIT for path [./wit]
1: failed to parse package: ./wit
2: name `usize` is not defined
--> ./wit/a.wit:52:42
|
52 | get-size: func() -> result<usize, type-error>;
|
Share
Improve this question
edited Feb 6 at 12:13
Harry
asked Feb 6 at 11:44
HarryHarry
2,9681 gold badge24 silver badges46 bronze badges
1 Answer
Reset to default 1From the wasm-bindgen
docs:
Note: Wasm is currently a 32-bit architecture, so isize and usize are 32-bit integers and "fit" into a JavaScript Number.
So you can use a u32
in place of usize
.