use Origin::ZERO constant

This commit is contained in:
Vinzenz Schroeter 2024-10-16 19:21:45 +02:00
parent 97a994fca2
commit cbadd85f07
9 changed files with 12 additions and 12 deletions

View file

@ -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");
}

View file

@ -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");
}

View file

@ -24,7 +24,7 @@ fn main() {
loop {
let command = Command::BitmapLinearWin(
Origin::new(0, 0),
Origin::ZERO,
field.clone(),
CompressionCode::Lzma,
);

View file

@ -25,7 +25,7 @@ fn main() {
}
let command = Command::BitmapLinearWin(
Origin::new(0, 0),
Origin::ZERO,
pixels.clone(),
CompressionCode::Lzma,
);

View file

@ -32,7 +32,7 @@ fn main() {
filled_grid.fill(true);
let command = BitmapLinearWin(
Origin::new(0, 0),
Origin::ZERO,
filled_grid,
CompressionCode::Lzma,
);

View file

@ -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,
));

View file

@ -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)]

View file

@ -26,7 +26,7 @@
//!
//! // create command to send pixels
//! let command = Command::BitmapLinearWin(
//! servicepoint::Origin::new(0, 0),
//! servicepoint::Origin::ZERO,
//! pixels,
//! CompressionCode::Uncompressed
//! );

View file

@ -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,