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§
- Enum
Concrete Type - Enum
From Bounded IntConcrete Libfunc - Enum
From Bounded IntLibfunc - 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. - Enum
Init Concrete Libfunc - Enum
Init Libfunc - Libfunc for setting a value to an enum.
- Enum
Match Libfunc - Libfunc for matching an enum.
- Enum
Snapshot Match Libfunc - Libfunc for matching an enum snapshot.
- Enum
Type - Type representing an enum.