Crate static_option

Source
Expand description

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>),
}

Structs§

StaticOptionNone
Type indicating that a static option is None.
StaticOptionSome
Type indicating that a static option is Some.

Traits§

StaticOptionSelector
A static option selector for Some or None. It is sealed and only implemented by StaticOptionSome and StaticOptionNone.

Type Aliases§

StaticOption
The static option type. Selector is either StaticOptionSome or StaticOptionNone. Type is the inner type of the option, like Option<Type> in the standard library.