Struct Prompt

Source
pub struct Prompt<'msg> { /* private fields */ }

Implementations§

Source§

impl Prompt<'_>

Source

pub fn read<T: FromStr>(&mut self) -> Result<T, T::Err>

Source

pub fn read_str(&mut self) -> &str

Source

pub fn read_string(self) -> String

Source

pub fn read_until_ok<A, Ef>(&mut self, handle_error: Ef) -> A
where A: FromStr, Ef: FnMut(A::Err),

Source

pub fn read_until_ok_with<T, E, F, Ef>( &mut self, action: F, handle_error: Ef, ) -> T
where F: FnMut(&str) -> Result<T, E>, Ef: FnMut(E),

Source

pub fn read_line<T: FromStr>(&mut self) -> Result<T, T::Err>

Source§

impl<'msg> Prompt<'msg>

Source

pub fn msg(self, msg: &'msg str) -> Self

Source§

impl Prompt<'_>

Source

pub fn new() -> Self

Source

pub fn get<T: FromStr>(&mut self) -> Result<T, T::Err>

Source

pub fn get_str(&mut self) -> &str

Source

pub fn get_string(self) -> String

Source

pub fn get_until_ok<A, Ef>(&mut self, handle_error: Ef) -> A
where A: FromStr, Ef: FnMut(A::Err),

Source

pub fn get_until_ok_with<T, E, F, Ef>( &mut self, action: F, handle_error: Ef, ) -> T
where F: FnMut(&str) -> Result<T, E>, Ef: FnMut(E),

Trait Implementations§

Source§

impl<'msg> Debug for Prompt<'msg>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Prompt<'_>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'msg> Freeze for Prompt<'msg>

§

impl<'msg> RefUnwindSafe for Prompt<'msg>

§

impl<'msg> Send for Prompt<'msg>

§

impl<'msg> Sync for Prompt<'msg>

§

impl<'msg> Unpin for Prompt<'msg>

§

impl<'msg> UnwindSafe for Prompt<'msg>

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