prompt_rs/prompts.rs
1#[derive(Debug)]
2pub struct Prompts<'a, F>
3 where F: Fn(InputType) -> Result<bool, &'a str>
4{
5 input_type: InputType,
6 message: &'a str,
7 validate: F,
8}
9
10#[derive(Debug)]
11pub enum InputType {
12 Number(Option<i32>)
13}
14
15impl<'a, F> Prompts<'a, F>
16where F: Fn(InputType) -> Result<bool, &'a str>
17{
18 pub fn new(input_type: InputType, message: &'a str, validate: F) -> Self {
19 Self {
20 input_type,
21 message,
22 validate
23 }
24 }
25}