Merge pull request #4223 from fufesou/fix/build_virtual_display_example
fix build example
This commit is contained in:
		
						commit
						2b8a98da06
					
				@ -1,6 +1,8 @@
 | 
				
			|||||||
use std::io::{self, Read};
 | 
					use std::io::{self, Read};
 | 
				
			||||||
 | 
					#[cfg(windows)]
 | 
				
			||||||
use virtual_display;
 | 
					use virtual_display;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[cfg(windows)]
 | 
				
			||||||
fn prompt_input() -> u8 {
 | 
					fn prompt_input() -> u8 {
 | 
				
			||||||
    println!("Press  key          execute:");
 | 
					    println!("Press  key          execute:");
 | 
				
			||||||
    println!("       1. 'q'       1. quit");
 | 
					    println!("       1. 'q'       1. quit");
 | 
				
			||||||
@ -18,6 +20,7 @@ fn prompt_input() -> u8 {
 | 
				
			|||||||
        .unwrap_or(0)
 | 
					        .unwrap_or(0)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[cfg(windows)]
 | 
				
			||||||
fn plug_in(monitor_index: u32) {
 | 
					fn plug_in(monitor_index: u32) {
 | 
				
			||||||
    println!("Plug in monitor begin");
 | 
					    println!("Plug in monitor begin");
 | 
				
			||||||
    if let Err(e) = virtual_display::plug_in_monitor(monitor_index as _) {
 | 
					    if let Err(e) = virtual_display::plug_in_monitor(monitor_index as _) {
 | 
				
			||||||
@ -27,6 +30,7 @@ fn plug_in(monitor_index: u32) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[cfg(windows)]
 | 
				
			||||||
fn plug_out(monitor_index: u32) {
 | 
					fn plug_out(monitor_index: u32) {
 | 
				
			||||||
    println!("Plug out monitor begin");
 | 
					    println!("Plug out monitor begin");
 | 
				
			||||||
    if let Err(e) = virtual_display::plug_out_monitor(monitor_index as _) {
 | 
					    if let Err(e) = virtual_display::plug_out_monitor(monitor_index as _) {
 | 
				
			||||||
@ -36,6 +40,7 @@ fn plug_out(monitor_index: u32) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[cfg(windows)]
 | 
				
			||||||
fn main() {
 | 
					fn main() {
 | 
				
			||||||
    loop {
 | 
					    loop {
 | 
				
			||||||
        let chr = prompt_input();
 | 
					        let chr = prompt_input();
 | 
				
			||||||
@ -92,3 +97,6 @@ fn main() {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[cfg(not(windows))]
 | 
				
			||||||
 | 
					fn main() {}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user