cairo_lang_sierra::extensions::modules

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§

Enums§