Skip to main content

ChoiceOptions

Trait ChoiceOptions 

Source
pub trait ChoiceOptions:
    Copy
    + Eq
    + 'static {
    const ALL: &'static [Self];

    // Required methods
    fn name(self) -> &'static str;
    fn description(self) -> Option<Content>;

    // Provided method
    fn from_name(name: &str) -> Option<Self> { ... }
}
Expand description

A fixed set of Choice options backed by a Rust type, usually a fieldless enum.

Implement it with choice_options! or by hand. The option names are the strings sent to the API and returned in answers, and must be unique.

Required Associated Constants§

Source

const ALL: &'static [Self]

Every option, in the order it is sent.

Required Methods§

Source

fn name(self) -> &'static str

The option name used on the wire.

Source

fn description(self) -> Option<Content>

When this option applies; None sends the name alone.

Provided Methods§

Source

fn from_name(name: &str) -> Option<Self>

Parses an option name from an answer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§