mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-25 06:00:34 +00:00
feat(layout): add Size::ZERO and Position::ORIGIN constants (#1253)
This commit is contained in:
parent
32d0695cc2
commit
5b89bd04a8
2 changed files with 6 additions and 0 deletions
|
@ -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 }
|
||||
|
|
|
@ -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 }
|
||||
|
|
Loading…
Reference in a new issue