feat(layout): add Size::ZERO and Position::ORIGIN constants (#1253)

This commit is contained in:
EdJoPaTo 2024-08-02 12:56:39 +02:00 committed by GitHub
parent 32d0695cc2
commit 5b89bd04a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View file

@ -40,6 +40,9 @@ pub struct Position {
}
impl Position {
/// Position at the origin, the top left edge at 0,0
pub const ORIGIN: Self = Self { x: 0, y: 0 };
/// Create a new position
pub const fn new(x: u16, y: u16) -> Self {
Self { x, y }

View file

@ -17,6 +17,9 @@ pub struct Size {
}
impl Size {
/// A zero sized Size
pub const ZERO: Self = Self::new(0, 0);
/// Create a new `Size` struct
pub const fn new(width: u16, height: u16) -> Self {
Self { width, height }