Trait smart_read::TryRead

source ·
pub trait TryRead {
    type Output;

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

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

Required Associated Types§

source

type Output

Defines the output of read and prompt macros

Required Methods§

source

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

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

Implementations on Foreign Types§

source§

impl TryRead for ()

§

type Output = String

source§

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

source§

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

§

type Output = 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,

§

type Output = 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,

§

type Output = 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,

§

type Output = 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,

§

type Output = T

source§

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

source§

impl<T: Display + Clone + PartialEq> TryRead for &[T]

§

type Output = T

source§

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

source§

impl<T: Display + Clone + PartialEq> TryRead for LinkedList<T>

§

type Output = T

source§

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

source§

impl<T: Display + Clone + PartialEq> TryRead for VecDeque<T>

§

type Output = T

source§

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

source§

impl<T: Display + Clone + PartialEq> TryRead for Vec<T>

§

type Output = T

source§

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

source§

impl<T: Display + Clone + PartialEq, const LEN: usize> TryRead for &[T; LEN]

§

type Output = T

source§

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

Implementors§

source§

impl TryRead for BoolInput

§

type Output = bool

source§

impl TryRead for CharInput

§

type Output = char

source§

impl TryRead for F32Input

§

type Output = f32

source§

impl TryRead for F64Input

§

type Output = f64

source§

impl TryRead for I8Input

§

type Output = i8

source§

impl TryRead for I16Input

§

type Output = i16

source§

impl TryRead for I32Input

§

type Output = i32

source§

impl TryRead for I64Input

§

type Output = i64

source§

impl TryRead for I128Input

§

type Output = i128

source§

impl TryRead for IsizeInput

source§

impl TryRead for NonEmptyInput

source§

impl TryRead for NonWhitespaceInput

source§

impl TryRead for U8Input

§

type Output = u8

source§

impl TryRead for U16Input

§

type Output = u16

source§

impl TryRead for U32Input

§

type Output = u32

source§

impl TryRead for U64Input

§

type Output = u64

source§

impl TryRead for U128Input

§

type Output = u128

source§

impl TryRead for UsizeInput

source§

impl TryRead for YesNoInput

§

type Output = bool

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>

§

type Output = O

source§

impl<T: Display + Clone + PartialEq> TryRead for EnumerateInput<&[T]>

§

type Output = (usize, T)

source§

impl<T: Display + Clone + PartialEq> TryRead for EnumerateInput<LinkedList<T>>

§

type Output = (usize, T)

source§

impl<T: Display + Clone + PartialEq> TryRead for EnumerateInput<VecDeque<T>>

§

type Output = (usize, T)

source§

impl<T: Display + Clone + PartialEq> TryRead for EnumerateInput<Vec<T>>

§

type Output = (usize, T)

source§

impl<T: Display + Clone + PartialEq, const LEN: usize> TryRead for EnumerateInput<&[T; LEN]>

§

type Output = (usize, T)