Trait read_input::InputBuild[][src]

pub trait InputBuild<T: FromStr> {
    fn msg(self, msg: impl ToString) -> Self;
fn repeat_msg(self, msg: impl ToString) -> Self;
fn err(self, err: impl ToString) -> Self;
fn add_test<F: Fn(&T) -> bool + 'static>(self, test: F) -> Self;
fn add_err_test<F>(self, test: F, err: impl ToString) -> Self
    where
        F: Fn(&T) -> bool + 'static
;
fn clear_tests(self) -> Self;
fn err_match<F>(self, err_match: F) -> Self
    where
        F: Fn(&T::Err) -> Option<String> + 'static
;
fn inside<U: InsideFunc<T>>(self, constraint: U) -> Self;
fn inside_err<U: InsideFunc<T>>(
        self,
        constraint: U,
        err: impl ToString
    ) -> Self;
fn toggle_msg_repeat(self) -> Self;
fn prompting_on(self, prompt_output: RefCell<Box<dyn Write>>) -> Self;
fn prompting_on_stderr(self) -> Self; }
Expand description

Trait for common types that store input settings.

Required methods

Changes or adds a prompt message that gets printed once when input if fetched.

Changes or adds a prompt message and that is repeated each time input is requested.

Changes fallback error message.

Adds a validation check on input.

Adds a validation check on input with a custom error message printed when the test fails.

Removes all validation checks made by .add_test(), .add_err_test(), .inside() and .inside_err().

Used specify custom error messages that depend on the errors produced by from_str().

Ensures that input is within a range, array or vector.

Ensures that input is within a range, array or vector with a custom error message printed when input fails.

Toggles whether a prompt message gets printed once or each time input is requested.

Send prompts to custom writer instead of stdout

Send prompts to stderr instead of stdout

Implementors