Lyricdev
GitHub

interface CEnum

pub interface CEnum :: [Variants]

Conforms to Variants.

An enum C holds as its integer: CEnum.from reads the integer C left in a struct's field or handed over as a plain integer, and CEnum.value gives the integer back.

Taken on request by an enum with @Layout, whose variants are units and may be given the integers C gives them: @Layout(C) enum Mode :: [CEnum] { Read = 1, Write = 2, Both = 3 }.

Methods

static fn from(n: int): ?Self

Returns the variant C's integer n stands for, or null where none does.

fn value(): int

Returns the integer C holds for this variant.