[−][src]Trait read_input::InputBuild
Trait for comman types that store input settings.
Required methods
fn msg(self, msg: impl ToString) -> Self
Changes or adds a prompt message that gets printed once when input if fetched.
fn repeat_msg(self, msg: impl ToString) -> Self
Changes or adds a prompt message and that is repeated each time input is requested.
fn err(self, err: impl ToString) -> Self
Changes fallback error message.
fn add_test<F: Fn(&T) -> bool + 'static>(self, test: F) -> Self
Adds a validation check on input.
fn add_err_test<F>(self, test: F, err: impl ToString) -> Self where
F: Fn(&T) -> bool + 'static,
F: Fn(&T) -> bool + 'static,
Adds a validation check on input with a custom error message printed when the test fails.
fn clear_tests(self) -> Self
Removes all validation checks made by .add_test()
, .add_err_test()
,
.inside()
and .inside_err()
.
fn err_match<F>(self, err_match: F) -> Self where
F: Fn(&T::Err) -> Option<String> + 'static,
F: Fn(&T::Err) -> Option<String> + 'static,
Used specify custom error messages that depend on the errors produced by from_str()
.
fn inside<U: InsideFunc<T>>(self, constraint: U) -> Self
Ensures that input is within a range, array or vector.
fn inside_err<U: InsideFunc<T>>(self, constraint: U, err: impl ToString) -> Self
Ensures that input is within a range, array or vector with a custom error message printed when input fails.
fn toggle_msg_repeat(self) -> Self
Toggles whether a prompt message gets printed once or each time input is requested.
Implementors
impl<T: FromStr> InputBuild<T> for InputBuilder<T>
[src]
fn msg(self, msg: impl ToString) -> Self
[src]
fn repeat_msg(self, msg: impl ToString) -> Self
[src]
fn err(self, err: impl ToString) -> Self
[src]
fn add_test<F: Fn(&T) -> bool + 'static>(self, test: F) -> Self
[src]
fn add_err_test<F>(self, test: F, err: impl ToString) -> Self where
F: Fn(&T) -> bool + 'static,
[src]
F: Fn(&T) -> bool + 'static,
fn clear_tests(self) -> Self
[src]
fn err_match<F>(self, err_match: F) -> Self where
F: Fn(&T::Err) -> Option<String> + 'static,
[src]
F: Fn(&T::Err) -> Option<String> + 'static,
fn inside<U: InsideFunc<T>>(self, constraint: U) -> Self
[src]
fn inside_err<U: InsideFunc<T>>(self, constraint: U, err: impl ToString) -> Self
[src]
fn toggle_msg_repeat(self) -> Self
[src]
impl<T: FromStr> InputBuild<T> for InputBuilderOnce<T>
[src]
fn msg(self, msg: impl ToString) -> Self
[src]
fn repeat_msg(self, msg: impl ToString) -> Self
[src]
fn err(self, err: impl ToString) -> Self
[src]
fn add_test<F: Fn(&T) -> bool + 'static>(self, test: F) -> Self
[src]
fn add_err_test<F>(self, test: F, err: impl ToString) -> Self where
F: Fn(&T) -> bool + 'static,
[src]
F: Fn(&T) -> bool + 'static,
fn clear_tests(self) -> Self
[src]
fn err_match<F>(self, err_match: F) -> Self where
F: Fn(&T::Err) -> Option<String> + 'static,
[src]
F: Fn(&T::Err) -> Option<String> + 'static,