Module enm

Source
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§

EnumConcreteType
EnumFromBoundedIntConcreteLibfunc
EnumFromBoundedIntLibfunc
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 the BoundedInt type, and the range starts from 0.
EnumInitConcreteLibfunc
EnumInitLibfunc
Libfunc for setting a value to an enum.
EnumMatchLibfunc
Libfunc for matching an enum.
EnumSnapshotMatchLibfunc
Libfunc for matching an enum snapshot.
EnumType
Type representing an enum.

Enums§

EnumConcreteLibfunc
EnumLibfunc