Then

Struct Then 

Source
pub struct Then<A, B, O> { /* private fields */ }
Expand description

Wrapper for chaining prompts.

See the Promptable::then() method for more information.

Trait Implementations§

Source§

impl<A, B, O> Flattenable for Then<A, B, O>
where A: Promptable, B: Promptable,

Source§

type RawOutput = (<A as Promptable>::Output, <B as Promptable>::Output)

The raw output type (e.g. (((A, B), C), D)).
Source§

impl<A, B, O> Promptable for Then<A, B, O>
where A: Promptable, B: Promptable, O: FromOutput<<Self as Flattenable>::RawOutput>,

Source§

type Output = O

The type of the output of the prompt.
Source§

type FmtRules = ThenFmtRules<<A as Promptable>::FmtRules, <B as Promptable>::FmtRules>

The type of styling rules the promptable supports.
Source§

fn prompt_once<R, W>( &mut self, read: R, write: W, fmt: &Self::FmtRules, ) -> Result<ControlFlow<O>>
where R: BufRead, W: Write,

Prompts the user for an input. Read more
Source§

fn prompt_with<R, W>(&mut self, read: R, write: W) -> Result<Self::Output>
where R: BufRead, W: Write,

Prompts the user for an input until it’s valid.
Source§

fn prompt(&mut self) -> Result<Self::Output>

Prompts the user for an input until it’s valid, using the standard input and output.
Source§

fn max_tries(self, max: usize) -> MaxTries<Self>
where Self: Sized,

Limits the amount of tries for the prompt to succeed. Read more
Source§

fn then<P, O>(self, promptable: P) -> Then<Self, P, O>
where Self: Sized, P: Promptable, O: FromOutput<<Then<Self, P, O> as Flattenable>::RawOutput>,

Chains two prompts. Read more
Source§

fn until<F>(self, until: F) -> Until<Self, F>
where Self: Sized, F: FnMut(&Self::Output) -> bool,

Adds a filter to the user input, before validating it. Read more
Source§

fn map<F, T>(self, map: F) -> Map<Self, F>
where Self: Sized, F: FnMut(Self::Output) -> T,

Maps the user input into another value. Read more
Source§

fn fmt<F>(self, fmt: F) -> Formatted<Self>
where Self: Sized, Self::FmtRules: From<F>,

Gives the promptable a custom format. Read more

Auto Trait Implementations§

§

impl<A, B, O> Freeze for Then<A, B, O>
where A: Freeze, B: Freeze,

§

impl<A, B, O> RefUnwindSafe for Then<A, B, O>

§

impl<A, B, O> Send for Then<A, B, O>
where A: Send, B: Send, O: Send,

§

impl<A, B, O> Sync for Then<A, B, O>
where A: Sync, B: Sync, O: Sync,

§

impl<A, B, O> Unpin for Then<A, B, O>
where A: Unpin, B: Unpin, O: Unpin,

§

impl<A, B, O> UnwindSafe for Then<A, B, O>
where A: UnwindSafe, B: UnwindSafe, O: UnwindSafe,

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromOutput<T> for T

Source§

fn from_output(output: T) -> T

Converts the raw output into this type.
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.