use Origin::ZERO constant
This commit is contained in:
		
							parent
							
								
									97a994fca2
								
							
						
					
					
						commit
						cbadd85f07
					
				
					 9 changed files with 12 additions and 12 deletions
				
			
		|  | @ -46,6 +46,6 @@ fn main() { | |||
|     let cp437_grid = Cp437Grid::from(&grid); | ||||
| 
 | ||||
|     connection | ||||
|         .send(Command::Cp437Data(Origin::new(0, 0), cp437_grid)) | ||||
|         .send(Command::Cp437Data(Origin::ZERO, cp437_grid)) | ||||
|         .expect("sending text failed"); | ||||
| } | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ fn main() { | |||
|     pixels.fill(true); | ||||
| 
 | ||||
|     let command = Command::BitmapLinearWin( | ||||
|         Origin::new(0, 0), | ||||
|         Origin::ZERO, | ||||
|         pixels, | ||||
|         CompressionCode::Uncompressed, | ||||
|     ); | ||||
|  | @ -33,6 +33,6 @@ fn main() { | |||
|     } | ||||
| 
 | ||||
|     connection | ||||
|         .send(Command::CharBrightness(Origin::new(0, 0), brightnesses)) | ||||
|         .send(Command::CharBrightness(Origin::ZERO, brightnesses)) | ||||
|         .expect("send failed"); | ||||
| } | ||||
|  |  | |||
|  | @ -24,7 +24,7 @@ fn main() { | |||
| 
 | ||||
|     loop { | ||||
|         let command = Command::BitmapLinearWin( | ||||
|             Origin::new(0, 0), | ||||
|             Origin::ZERO, | ||||
|             field.clone(), | ||||
|             CompressionCode::Lzma, | ||||
|         ); | ||||
|  |  | |||
|  | @ -25,7 +25,7 @@ fn main() { | |||
|         } | ||||
| 
 | ||||
|         let command = Command::BitmapLinearWin( | ||||
|             Origin::new(0, 0), | ||||
|             Origin::ZERO, | ||||
|             pixels.clone(), | ||||
|             CompressionCode::Lzma, | ||||
|         ); | ||||
|  |  | |||
|  | @ -32,7 +32,7 @@ fn main() { | |||
|         filled_grid.fill(true); | ||||
| 
 | ||||
|         let command = BitmapLinearWin( | ||||
|             Origin::new(0, 0), | ||||
|             Origin::ZERO, | ||||
|             filled_grid, | ||||
|             CompressionCode::Lzma, | ||||
|         ); | ||||
|  |  | |||
|  | @ -114,7 +114,7 @@ pub enum Command { | |||
|     ///
 | ||||
|     /// // create command to send pixels
 | ||||
|     /// let command = Command::BitmapLinearWin(
 | ||||
|     ///    servicepoint::Origin::new(0, 0),
 | ||||
|     ///    servicepoint::Origin::ZERO,
 | ||||
|     ///    pixels,
 | ||||
|     ///    CompressionCode::Uncompressed
 | ||||
|     /// );
 | ||||
|  | @ -588,7 +588,7 @@ mod tests { | |||
|                 compression, | ||||
|             )); | ||||
|             round_trip(Command::BitmapLinearWin( | ||||
|                 Origin::new(0, 0), | ||||
|                 Origin::ZERO, | ||||
|                 Bitmap::max_sized(), | ||||
|                 compression, | ||||
|             )); | ||||
|  |  | |||
|  | @ -6,11 +6,11 @@ | |||
| /// # use servicepoint::{Command, CompressionCode, Origin, Bitmap};
 | ||||
| /// // create command without payload compression
 | ||||
| /// # let pixels = Bitmap::max_sized();
 | ||||
| /// _ = Command::BitmapLinearWin(Origin::new(0, 0), pixels, CompressionCode::Uncompressed);
 | ||||
| /// _ = Command::BitmapLinearWin(Origin::ZERO, pixels, CompressionCode::Uncompressed);
 | ||||
| ///
 | ||||
| /// // create command with payload compressed with lzma and appropriate header flags
 | ||||
| /// # let pixels = Bitmap::max_sized();
 | ||||
| /// _ = Command::BitmapLinearWin(Origin::new(0, 0), pixels, CompressionCode::Lzma);
 | ||||
| /// _ = Command::BitmapLinearWin(Origin::ZERO, pixels, CompressionCode::Lzma);
 | ||||
| /// ```
 | ||||
| #[repr(u16)] | ||||
| #[derive(Debug, Clone, Copy, PartialEq)] | ||||
|  |  | |||
|  | @ -26,7 +26,7 @@ | |||
| //!
 | ||||
| //!  // create command to send pixels
 | ||||
| //!  let command = Command::BitmapLinearWin(
 | ||||
| //!     servicepoint::Origin::new(0, 0),
 | ||||
| //!     servicepoint::Origin::ZERO,
 | ||||
| //!     pixels,
 | ||||
| //!     CompressionCode::Uncompressed
 | ||||
| //!  );
 | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ pub struct Origin<Unit: DisplayUnit> { | |||
| } | ||||
| 
 | ||||
| impl<Unit: DisplayUnit> Origin<Unit> { | ||||
|     /// Top-left. Equivalent to `Origin::new(0, 0)`.
 | ||||
|     /// Top-left. Equivalent to `Origin::ZERO`.
 | ||||
|     pub const ZERO: Self = Self { | ||||
|         x: 0, | ||||
|         y: 0, | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Vinzenz Schroeter
						Vinzenz Schroeter