Skip to main content

Given

Struct Given 

Source
pub struct Given<'a> { /* private fields */ }
Expand description

The options a pass (or a TextForm) is made from, after its declaration let them through (PassSpec::check). Reading a key the declaration does not have, or reading it as what it is not declared as, is a bug in the pass: a panic.

Implementations§

Source§

impl<'a> Given<'a>

Source

pub fn required(&self, key: &str) -> &'a str

A required option’s value: always there.

Source

pub fn optional(&self, key: &str) -> Option<&'a str>

An optional option’s value, or a one-of option’s, if given.

Source

pub fn choice<T: Choice>(&self, key: &str) -> T

A required choice’s value.

Source

pub fn optional_choice<T: Choice>(&self, key: &str) -> Option<T>

An optional choice’s value, if given.

Trait Implementations§

Source§

impl<'a> Debug for Given<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Forget for Given<'a>

§

impl<'a> Freeze for Given<'a>

§

impl<'a> RefUnwindSafe for Given<'a>

§

impl<'a> Send for Given<'a>

§

impl<'a> Sync for Given<'a>

§

impl<'a> Unpin for Given<'a>

§

impl<'a> UnsafeUnpin for Given<'a>

§

impl<'a> UnwindSafe for Given<'a>

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> 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, 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.