Expand description
Sierra example:
ⓘ
type felt252_ty = felt252;
type unit_ty = Tuple;
type Option = Enum<felt252_ty, unit_ty>;
libfunc init_option_some = enum_init<Option, 0>;
libfunc init_option_none = enum_init<Option, 1>;
libfunc match_option = enum_match<Option>;
...
felt252_const<0>() -> (felt0);
tuple_const() -> (unit);
init_option_some(felt0) -> (some_id);
init_option_none(unit) -> (none_id);
match_option(some_id) {1000(some), 2000(none)};
match_option(none_id) {1000(some), 2000(none)};
Structs§
- Libfunc for creating an enum from a
BoundedInt
type. Will only work where there are the same number of empty variants as in the range of theBoundedInt
type, and the range starts from 0. - Libfunc for setting a value to an enum.
- Libfunc for matching an enum.
- Libfunc for matching an enum snapshot.
- Type representing an enum.