#[derive(EnumIsA)]
Expand description
Macro EnumIsA
Derives functions of the form fn is_{variant_name}(&self) -> bool
returning true
if an enumeration instance is of some variant. For lists, it would generate
is_cons
and is_nil
.
Note that there already exists a crate implementing such macros,
enum_methods
, but
it doesn’t work when the enumeration has generic parameters and it seems
dead (a PR from 2019 has never been merged), so it seems better to maintain
our own code here (which is small) rather than doing PRs for this crate.