pub fn choose(mut self) -> Project {
        let key: &str = loop {
            io::stdout().write_all(b" >> ").unwrap();
            let _ = io::stdout().flush();

            let mut input = String::new();
            io::stdin().read_line(&mut input).unwrap();

            match input.trim().parse::<usize>() {
                Ok(val) if val >= 1 && val <= self.num_of_projects => {
                    break self.AVAILABLE_PROJECTS[val - 1];
                }
                _ => {
                    println!(
                        " [!!] Input should be numbers between {} and {}.",
                        1, self.num_of_projects
                    );
                    continue;
                }
            };
        };
        self.key = key;

        self
    }
/// Prompts the user to choose from the available projects
///
/// Sets key to which project the user has chosen. Returns the instance of the `Project`.
///
/// # Examples
///
/// ```rust
/// # fn main() {
/// let project = Project::new();
/// project.display().choose();
/// # }
/// ```
Prompts the user to choose from the available projects
Sets key to which project the user has chosen. Returns the instance of the `Project`.
Prompts the user to choose from the available projects Sets key to which project the user has chosen . Returns the instance of the ` Project ` .
pub fn choose(mut self) -> Project {
        let key: &str = loop {
            io::stdout().write_all(b" >> ").unwrap();
            let _ = io::stdout().flush();
            let mut input = String::new();
            io::stdin().read_line(&mut input).unwrap();
            match input.trim().parse::<usize>() {
                Ok(val) if val >= 1 && val <= self.num_of_projects => {
                    break self.AVAILABLE_PROJECTS[val - 1];
                }
                _ => {
                    println!(
                        " [!!] Input should be numbers between {} and {}.",
                        1, self.num_of_projects
                    );
                    continue;
                }
            };
        };
        self.key = key;
        self
    }
pub fn choose ( mut self ) -> Project { let key : & str = loop { io :: stdout ( ) . write_all ( b" " ) . unwrap ( ) ; let _ = io :: stdout ( ) . flush ( ) ; let mut input = String :: new ( ) ; io :: stdin ( ) . read_line ( & mut input ) . unwrap ( ) ; match input . trim ( ) . parse :: < usize > ( ) { Ok ( val ) if val >= 1 && val <= self . num_of_projects => { break self . AVAILABLE_PROJECTS [ val - 1 ] ; } _ => { println ! ( " " 1 self num_of_projects ) ; continue ; } } ; } ; self . key = key ; self }
Prompts the user to choose from the available projects
Sets key to which project the user has chosen.
Prompts the user to choose from the available projects Sets key to which project the user has chosen .
mut self
mut self
examples
None
fn main() {
let project = Project::new();
project.display().choose().
let project = Project :: new () ; project . display () . choose () .
}
None