Skip to main content

OptionSpec

Struct OptionSpec 

Source
pub struct OptionSpec { /* private fields */ }
Expand description

One option a pass takes: its key, whether it is needed, an example value and what it means. Built only by its constructors, so a required option always has its example and an optional one always says what its absence means.

Implementations§

Source§

impl OptionSpec

Source

pub const fn required( key: &'static str, example: &'static str, doc: &'static str, ) -> Self

An option a pipeline must give.

Source

pub const fn optional( key: &'static str, example: &'static str, doc: &'static str, absent: &'static str, ) -> Self

An option a pipeline may give; absent says what no value means (the registry refuses an empty one). Its example only documents it: optional options may exclude each other (at=centre or east and north), so the registry makes no pass from them.

Source

pub const fn one_of( group: &'static str, key: &'static str, example: &'static str, doc: &'static str, ) -> Self

One of the options of group, of which a pipeline gives exactly one.

Source

pub const fn one_of_choice<T: Choice>( group: &'static str, key: &'static str, doc: &'static str, ) -> Self

One of the options of group, of which a pipeline gives exactly one, whose value is one of T’s; the example is the first. Read by Given::optional_choice.

Source

pub const fn choice<T: Choice>(key: &'static str, doc: &'static str) -> Self

A required option whose value is one of T’s; the example is the first.

Source

pub const fn optional_choice<T: Choice>( key: &'static str, doc: &'static str, absent: &'static str, ) -> Self

An optional option whose value, when given, is one of T’s; absent says what no value means.

Source

pub fn key(&self) -> &'static str

Source

pub fn example(&self) -> &'static str

Source

pub fn doc(&self) -> &'static str

Source

pub fn absent(&self) -> Option<&'static str>

What no value means, for an optional option.

Source

pub fn is_needed(&self) -> bool

Whether a pipeline must give it (alone, or as one of its group).

Source

pub fn group(&self) -> Option<&'static str>

The group it is one of, if it is.

Source

pub fn values(&self) -> Option<Vec<&'static str>>

The texts of its values, for a choice option.

Trait Implementations§

Source§

impl Clone for OptionSpec

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for OptionSpec

Source§

impl Debug for OptionSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.