fn prompt_for_monitor(event_loop: &EventLoop<()>) -> MonitorHandle {
    for (num, monitor) in event_loop.available_monitors().enumerate() {
        println!("Monitor #{}: {:?}", num, monitor.name());
    }

    print!("Please write the number of the monitor to use: ");
    io::stdout().flush().unwrap();

    let mut num = String::new();
    io::stdin().read_line(&mut num).unwrap();
    let num = num.trim().parse().ok().expect("Please enter a number");
    let monitor = event_loop
        .available_monitors()
        .nth(num)
        .expect("Please enter a valid ID");

    println!("Using {:?}", monitor.name());

    monitor
}
// Enumerate monitors and prompt user to choose one
Enumerate monitors and prompt user to choose one
Enumerate monitors and prompt user to choose one
fn prompt_for_monitor(event_loop: &EventLoop<()>) -> MonitorHandle {
    for (num, monitor) in event_loop.available_monitors().enumerate() {
        println!("Monitor #{}: {:?}", num, monitor.name());
    }
    print!("Please write the number of the monitor to use: ");
    io::stdout().flush().unwrap();
    let mut num = String::new();
    io::stdin().read_line(&mut num).unwrap();
    let num = num.trim().parse().ok().expect("Please enter a number");
    let monitor = event_loop
        .available_monitors()
        .nth(num)
        .expect("Please enter a valid ID");
    println!("Using {:?}", monitor.name());
    monitor
}
fn prompt_for_monitor ( event_loop : & EventLoop < ( ) > ) -> MonitorHandle { for ( num , monitor ) in event_loop . available_monitors ( ) . enumerate ( ) { println ! ( " " num monitor name ( ) ) ; } print ! ( " " ) ; io :: stdout ( ) . flush ( ) . unwrap ( ) ; let mut num = String :: new ( ) ; io :: stdin ( ) . read_line ( & mut num ) . unwrap ( ) ; let num = num . trim ( ) . parse ( ) . ok ( ) . expect ( " " ) ; let monitor = event_loop . available_monitors ( ) . nth ( num ) . expect ( " " ) ; println ! ( " " monitor name ( ) ) ; monitor }
Enumerate monitors and prompt user to choose one
Enumerate monitors and prompt user to choose one
event_loop
&EventLoop<()>
event_loop
&EventLoop<()>