#options #static #statically #parameters #enums

static_option

An option type that is statically known to be Some or None

1 unstable release

0.1.0 Feb 22, 2024

#33 in #statically

BSD-2-Clause

3KB

An option type that is always Some or None, depending on a static type parameter.

Example


use static_option::*;

enum Inner<Selector: StaticOptionSelector> {
    A(StaticOption<Selector, i32>),
    B(StaticOption<Selector, u32>),
}

enum MaybeInitialised {
    Initialised(Inner<StaticOptionSome>),
    Uninitialised(Inner<StaticOptionNone>),
}

No runtime deps