mirror of
https://github.com/ratatui/ratatui.git
synced 2025-10-02 07:21:24 +00:00
feat(layout): add Offset::new() constructor (#1547)
This commit is contained in:
parent
15f442a71e
commit
9275d3421c
@ -40,6 +40,16 @@ pub struct Offset {
|
|||||||
pub y: i32,
|
pub y: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Offset {
|
||||||
|
/// A zero offset
|
||||||
|
pub const ZERO: Self = Self { x: 0, y: 0 };
|
||||||
|
|
||||||
|
/// Creates a new `Offset` with the given values.
|
||||||
|
pub const fn new(x: i32, y: i32) -> Self {
|
||||||
|
Self { x, y }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl fmt::Display for Rect {
|
impl fmt::Display for Rect {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "{}x{}+{}+{}", self.width, self.height, self.x, self.y)
|
write!(f, "{}x{}+{}+{}", self.width, self.height, self.x, self.y)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user