examples: error message on connection failure
This commit is contained in:
		
							parent
							
								
									7200cb3247
								
							
						
					
					
						commit
						e1f009ee6f
					
				
					 6 changed files with 16 additions and 9 deletions
				
			
		|  | @ -22,9 +22,11 @@ fn main() { | |||
|         cli.text.push("Hello, CCCB!".to_string()); | ||||
|     } | ||||
| 
 | ||||
|     let connection = Connection::open(&cli.destination).unwrap(); | ||||
|     let connection = Connection::open(&cli.destination) | ||||
|         .expect("could not connect to display"); | ||||
| 
 | ||||
|     if cli.clear { | ||||
|         connection.send(Command::Clear).unwrap(); | ||||
|         connection.send(Command::Clear).expect("sending clear failed"); | ||||
|     } | ||||
| 
 | ||||
|     let max_width = cli.text.iter().map(|t| t.len()).max().unwrap(); | ||||
|  | @ -41,5 +43,5 @@ fn main() { | |||
| 
 | ||||
|     connection | ||||
|         .send(Command::Cp437Data(Origin(0, 0), chars)) | ||||
|         .unwrap(); | ||||
|         .expect("sending text failed"); | ||||
| } | ||||
|  |  | |||
|  | @ -13,7 +13,8 @@ struct Cli { | |||
| 
 | ||||
| fn main() { | ||||
|     let cli = Cli::parse(); | ||||
|     let connection = Connection::open(cli.destination).unwrap(); | ||||
|     let connection = Connection::open(cli.destination) | ||||
|         .expect("could not connect to display"); | ||||
| 
 | ||||
|     let mut pixels = PixelGrid::max_sized(); | ||||
|     pixels.fill(true); | ||||
|  |  | |||
|  | @ -18,7 +18,8 @@ struct Cli { | |||
| fn main() { | ||||
|     let cli = Cli::parse(); | ||||
| 
 | ||||
|     let connection = Connection::open(&cli.destination).unwrap(); | ||||
|     let connection = Connection::open(&cli.destination) | ||||
|         .expect("could not connect to display"); | ||||
|     let mut field = make_random_field(cli.probability); | ||||
| 
 | ||||
|     loop { | ||||
|  |  | |||
|  | @ -13,7 +13,8 @@ struct Cli { | |||
| } | ||||
| 
 | ||||
| fn main() { | ||||
|     let connection = Connection::open(Cli::parse().destination).unwrap(); | ||||
|     let connection = Connection::open(Cli::parse().destination) | ||||
|         .expect("could not connect to display"); | ||||
| 
 | ||||
|     let mut pixels = PixelGrid::max_sized(); | ||||
|     for x_offset in 0..usize::MAX { | ||||
|  |  | |||
|  | @ -22,7 +22,8 @@ struct Cli { | |||
| fn main() { | ||||
|     let cli = Cli::parse(); | ||||
| 
 | ||||
|     let connection = Connection::open(cli.destination).unwrap(); | ||||
|     let connection = Connection::open(cli.destination) | ||||
|         .expect("could not connect to display"); | ||||
|     let wait_duration = Duration::from_millis(cli.wait_ms); | ||||
| 
 | ||||
|     // put all pixels in on state
 | ||||
|  |  | |||
|  | @ -22,7 +22,8 @@ fn main() { | |||
|         Duration::from_millis(cli.time / PIXEL_WIDTH as u64), | ||||
|     ); | ||||
| 
 | ||||
|     let connection = Connection::open(cli.destination).unwrap(); | ||||
|     let connection = Connection::open(cli.destination) | ||||
|         .expect("could not connect to display"); | ||||
| 
 | ||||
|     let mut enabled_pixels = PixelGrid::new(PIXEL_WIDTH, PIXEL_HEIGHT); | ||||
|     enabled_pixels.fill(true); | ||||
|  | @ -38,7 +39,7 @@ fn main() { | |||
| 
 | ||||
|         connection | ||||
|             .send(Command::BitmapLinearAnd(0, bit_vec, CompressionCode::Lzma)) | ||||
|             .unwrap(); | ||||
|             .expect("could not send command to display"); | ||||
|         thread::sleep(sleep_duration); | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Vinzenz Schroeter
						Vinzenz Schroeter