Lyricdev
GitHub

interface Variants

pub interface Variants :: [VariantName]

Conforms to VariantName.

Gives an enum's variants as values: all of them in declaration order, and one by its name.

Only for an enum whose variants all are units; an enum with a payload variant is refused at its conformance.

Methods

static fn all(): Self[]

Returns every variant, in declaration order.

static fn fromName(s: string): ?Self

Returns the variant named s, or null where there is none.