std::variants
Import with import std::variants.
Exports
Section titled “Exports”Interfaces
interface Variants
Section titled “interface Variants”interface Variants fn variants() -> List<self> end
Variants lists every value of an enum whose variants carry no data.
T.variants() returns them in declaration order, the order
derive Comparable ranks them in, so the list is sorted when the enum
derives both.
derive Variants for T writes the impl. It accepts an enum without type
parameters whose variants all carry no data; a variant that carries data
has no single value to list, so deriving it there is a compile error.
assert Ordering.variants() == [Ordering.Less, Ordering.Equal, Ordering.Greater]
Variants.variants
Section titled “Variants.variants”fn variants() -> List<self>
interface Variants