Trait TryRead

Source
pub trait TryRead {
    type Output;
    type Default;

    // Required method
    fn try_read_line(
        self,
        prompt: Option<String>,
        default: Option<Self::Default>,
    ) -> BoxResult<Self::Output>;
}
Expand description

This is what powers the whole crate. Any type that implements this can be used with the macros

Required Associated Types§

Source

type Output

Defines the output type of read and prompt macros

Source

type Default

Defines the type of the default input

Required Methods§

Source

fn try_read_line( self, prompt: Option<String>, default: Option<Self::Default>, ) -> BoxResult<Self::Output>

This is what’s called by the read and prompt macros

Implementations on Foreign Types§

Source§

impl TryRead for ()

Source§

type Output = String

Source§

type Default = String

Source§

fn try_read_line( self, prompt: Option<String>, default: Option<Self::Default>, ) -> BoxResult<Self::Output>

Source§

impl<'a, Data> TryRead for &'a [InputOption<Data>]

Source§

type Output = (usize, &'a InputOption<Data>)

Source§

type Default = usize

Source§

fn try_read_line( self, prompt: Option<String>, default: Option<Self::Default>, ) -> BoxResult<Self::Output>

Source§

impl<'a, Data, const LEN: usize> TryRead for &'a [InputOption<Data>; LEN]

Source§

type Output = (usize, &'a InputOption<Data>)

Source§

type Default = usize

Source§

fn try_read_line( self, prompt: Option<String>, default: Option<Self::Default>, ) -> BoxResult<Self::Output>

Source§

impl<'a, T: Display> TryRead for &'a [T]

Source§

type Output = (usize, &'a T)

Source§

type Default = usize

Source§

fn try_read_line( self, prompt: Option<String>, default: Option<Self::Default>, ) -> BoxResult<Self::Output>

Source§

impl<Data, const LEN: usize> TryRead for [InputOption<Data>; LEN]

Source§

type Output = (usize, InputOption<Data>)

Source§

type Default = usize

Source§

fn try_read_line( self, prompt: Option<String>, default: Option<Self::Default>, ) -> BoxResult<Self::Output>

Source§

impl<T> TryRead for Range<T>
where T: Display + FromStr + PartialOrd<T>, <T as FromStr>::Err: Display,

Source§

type Output = T

Source§

type Default = T

Source§

fn try_read_line( self, prompt: Option<String>, default: Option<Self::Output>, ) -> BoxResult<Self::Output>

Source§

impl<T> TryRead for RangeFrom<T>
where T: Display + FromStr + PartialOrd<T>, <T as FromStr>::Err: Display,

Source§

type Output = T

Source§

type Default = T

Source§

fn try_read_line( self, prompt: Option<String>, default: Option<Self::Output>, ) -> BoxResult<Self::Output>

Source§

impl<T> TryRead for RangeInclusive<T>
where T: Display + FromStr + PartialOrd<T>, <T as FromStr>::Err: Display,

Source§

type Output = T

Source§

type Default = T

Source§

fn try_read_line( self, prompt: Option<String>, default: Option<Self::Output>, ) -> BoxResult<Self::Output>

Source§

impl<T> TryRead for RangeTo<T>
where T: Display + FromStr + PartialOrd<T>, <T as FromStr>::Err: Display,

Source§

type Output = T

Source§

type Default = T

Source§

fn try_read_line( self, prompt: Option<String>, default: Option<Self::Output>, ) -> BoxResult<Self::Output>

Source§

impl<T> TryRead for RangeToInclusive<T>
where T: Display + FromStr + PartialOrd<T>, <T as FromStr>::Err: Display,

Source§

type Output = T

Source§

type Default = T

Source§

fn try_read_line( self, prompt: Option<String>, default: Option<Self::Output>, ) -> BoxResult<Self::Output>

Source§

impl<T: Display> TryRead for LinkedList<T>

Source§

type Output = (usize, T)

Source§

type Default = usize

Source§

fn try_read_line( self, prompt: Option<String>, default: Option<Self::Default>, ) -> BoxResult<Self::Output>

Source§

impl<T: Display> TryRead for VecDeque<T>

Source§

type Output = (usize, T)

Source§

type Default = usize

Source§

fn try_read_line( self, prompt: Option<String>, default: Option<Self::Default>, ) -> BoxResult<Self::Output>

Source§

impl<T: Display> TryRead for Vec<T>

Source§

type Output = (usize, T)

Source§

type Default = usize

Source§

fn try_read_line( self, prompt: Option<String>, default: Option<Self::Default>, ) -> BoxResult<Self::Output>

Source§

impl<T: Display, const LEN: usize> TryRead for [T; LEN]

Source§

type Output = (usize, T)

Source§

type Default = usize

Source§

fn try_read_line( self, prompt: Option<String>, default: Option<Self::Default>, ) -> BoxResult<Self::Output>

Implementors§

Source§

impl TryRead for BoolInput

Source§

impl TryRead for CharInput

Source§

impl TryRead for F32Input

Source§

impl TryRead for F64Input

Source§

impl TryRead for I8Input

Source§

impl TryRead for I16Input

Source§

impl TryRead for I32Input

Source§

impl TryRead for I64Input

Source§

impl TryRead for I128Input

Source§

impl TryRead for IsizeInput

Source§

impl TryRead for NonEmptyInput

Source§

impl TryRead for NonWhitespaceInput

Source§

impl TryRead for U8Input

Source§

impl TryRead for U16Input

Source§

impl TryRead for U32Input

Source§

impl TryRead for U64Input

Source§

impl TryRead for U128Input

Source§

impl TryRead for UsizeInput

Source§

impl TryRead for YesNoInput

Source§

impl<F: Fn(&str) -> Result<(), String>> TryRead for SimpleValidate<F>

Source§

impl<F: Fn(String) -> Result<O, String>, O: Display> TryRead for TransformValidate<F, O>