mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-04-03 13:30:44 +02:00
allow rect.into()
This commit is contained in:
parent
dae4d5a140
commit
c0d8c5f1bb
1 changed files with 5 additions and 0 deletions
|
|
@ -11,6 +11,11 @@ use crate::{*, draw::*};
|
|||
///
|
||||
#[cfg_attr(test, derive(Arbitrary))] #[derive(Copy, Clone, Debug, Default, PartialEq)]
|
||||
pub struct XYWH<N: Coord>(pub N, pub N, pub N, pub N);
|
||||
impl From<&ratatui::prelude::Rect> for XYWH<u16> {
|
||||
fn from (rect: &ratatui::prelude::Rect) -> Self {
|
||||
Self(rect.x, rect.y, rect.width, rect.height)
|
||||
}
|
||||
}
|
||||
impl<N: Coord> X<N> for XYWH<N> { fn x (&self) -> N { self.0 } fn w (&self) -> N { self.2 } }
|
||||
impl<N: Coord> Y<N> for XYWH<N> { fn y (&self) -> N { self.0 } fn h (&self) -> N { self.2 } }
|
||||
impl<N: Coord> XYWH<N> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue