Macro smart_read::read
source · macro_rules! read { ($($args:tt)*) => { ... }; }
Expand description
reads a line of text, a number, etc
General syntax: read!([default_value] …) // works with prompt, like prompt!(“Give input: “; [3])
Existing functionalities:
Input Options These allow you to specify which inputs are allowed. Example: read!(&[“a”, “b”, “c”]) Special syntax: read!(= 1, 2, 3)
Implemented types:
impl<T: ToString + Clone> ReadLine for ReadData<T, &[T]>
impl<T: ToString + Clone> ReadLine for ReadData<T, &[T; LEN]>
impl<T: ToString + Clone> ReadLine for ReadData<T, Vec
Ranges These allow you to take a number within a specified range. Example: read!(1. .. 100.), or read!(10..), etc
Implemented types:
impl<T: Display + FromStr + PartialOrd
If you have ideas for more functionality, feel free to open an issue