From b7b1055fbce591e3101c4135bd5b691ee726cd12 Mon Sep 17 00:00:00 2001 From: same mf who else Date: Sun, 15 Feb 2026 06:18:09 +0200 Subject: [PATCH] refactor(layout): prefix methods (13 errors) --- output/src/lib.rs | 4 +- output/src/out_impls.rs | 211 +++++++++++++++++++++------------------ output/src/out_traits.rs | 18 ++-- 3 files changed, 125 insertions(+), 108 deletions(-) diff --git a/output/src/lib.rs b/output/src/lib.rs index 6f6bc7a..40d31f0 100644 --- a/output/src/lib.rs +++ b/output/src/lib.rs @@ -117,8 +117,8 @@ macro_rules! layout_op_xy ( macro_rules! push_pull(($T:ident: $method: ident)=>{ layout_op_xy!(1: $T); impl> Layout for $T { - fn x (&self, area: XYWH) -> O::Unit { area.x().$method(self.dx()) } - fn y (&self, area: XYWH) -> O::Unit { area.y().$method(self.dy()) } + fn layout_x (&self, area: XYWH) -> O::Unit { area.x().$method(self.dx()) } + fn layout_y (&self, area: XYWH) -> O::Unit { area.y().$method(self.dy()) } } }); diff --git a/output/src/out_impls.rs b/output/src/out_impls.rs index 956630f..38a051e 100644 --- a/output/src/out_impls.rs +++ b/output/src/out_impls.rs @@ -255,90 +255,89 @@ impl From<[O::Unit; 2]> for Measure { } impl Layout for () { - fn x (&self, a: XYWH) -> O::Unit { a.x() } - fn y (&self, a: XYWH) -> O::Unit { a.y() } - fn w (&self, _: XYWH) -> O::Unit { 0.into() } - fn w_min (&self, _: XYWH) -> O::Unit { 0.into() } - fn w_max (&self, _: XYWH) -> O::Unit { 0.into() } - fn h (&self, _: XYWH) -> O::Unit { 0.into() } - fn h_min (&self, _: XYWH) -> O::Unit { 0.into() } - fn h_max (&self, _: XYWH) -> O::Unit { 0.into() } + fn layout_x (&self, a: XYWH) -> O::Unit { a.x() } + fn layout_y (&self, a: XYWH) -> O::Unit { a.y() } + fn layout_w (&self, _: XYWH) -> O::Unit { 0.into() } + fn layout_w_min (&self, _: XYWH) -> O::Unit { 0.into() } + fn layout_w_max (&self, _: XYWH) -> O::Unit { 0.into() } + fn layout_h (&self, _: XYWH) -> O::Unit { 0.into() } + fn layout_h_min (&self, _: XYWH) -> O::Unit { 0.into() } + fn layout_h_max (&self, _: XYWH) -> O::Unit { 0.into() } fn layout (&self, a: XYWH) -> XYWH { XYWH(a.x(), a.y(), 0.into(), 0.into()) } } impl> Layout for &L { - fn x (&self, a: XYWH) -> O::Unit { (*self).x(a) } - fn y (&self, a: XYWH) -> O::Unit { (*self).y(a) } - fn w (&self, a: XYWH) -> O::Unit { (*self).w(a) } - fn w_min (&self, a: XYWH) -> O::Unit { (*self).w_min(a) } - fn w_max (&self, a: XYWH) -> O::Unit { (*self).w_max(a) } - fn h (&self, a: XYWH) -> O::Unit { (*self).h(a) } - fn h_min (&self, a: XYWH) -> O::Unit { (*self).h_min(a) } - fn h_max (&self, a: XYWH) -> O::Unit { (*self).h_max(a) } + fn layout_x (&self, a: XYWH) -> O::Unit { (*self).layout_x(a) } + fn layout_y (&self, a: XYWH) -> O::Unit { (*self).layout_y(a) } + fn layout_w (&self, a: XYWH) -> O::Unit { (*self).layout_w(a) } + fn layout_w_min (&self, a: XYWH) -> O::Unit { (*self).layout_w_min(a) } + fn layout_w_max (&self, a: XYWH) -> O::Unit { (*self).layout_w_max(a) } + fn layout_h (&self, a: XYWH) -> O::Unit { (*self).layout_h(a) } + fn layout_h_min (&self, a: XYWH) -> O::Unit { (*self).layout_h_min(a) } + fn layout_h_max (&self, a: XYWH) -> O::Unit { (*self).layout_h_max(a) } fn layout (&self, a: XYWH) -> XYWH { (*self).layout(a) } } impl> Layout for &mut L { - fn x (&self, a: XYWH) -> O::Unit { (**self).x(a) } - fn y (&self, a: XYWH) -> O::Unit { (**self).y(a) } - fn w (&self, a: XYWH) -> O::Unit { (**self).w(a) } - fn w_min (&self, a: XYWH) -> O::Unit { (**self).w_min(a) } - fn w_max (&self, a: XYWH) -> O::Unit { (**self).w_max(a) } - fn h (&self, a: XYWH) -> O::Unit { (**self).h(a) } - fn h_min (&self, a: XYWH) -> O::Unit { (**self).h_min(a) } - fn h_max (&self, a: XYWH) -> O::Unit { (**self).h_max(a) } + fn layout_x (&self, a: XYWH) -> O::Unit { (**self).layout_x(a) } + fn layout_y (&self, a: XYWH) -> O::Unit { (**self).layout_y(a) } + fn layout_w (&self, a: XYWH) -> O::Unit { (**self).layout_w(a) } + fn layout_w_min (&self, a: XYWH) -> O::Unit { (**self).layout_w_min(a) } + fn layout_w_max (&self, a: XYWH) -> O::Unit { (**self).layout_w_max(a) } + fn layout_h (&self, a: XYWH) -> O::Unit { (**self).layout_h(a) } + fn layout_h_min (&self, a: XYWH) -> O::Unit { (**self).layout_h_min(a) } + fn layout_h_max (&self, a: XYWH) -> O::Unit { (**self).layout_h_max(a) } fn layout (&self, a: XYWH) -> XYWH { (**self).layout(a) } } impl> Layout for Arc { - fn x (&self, a: XYWH) -> O::Unit { (**self).x(a) } - fn y (&self, a: XYWH) -> O::Unit { (**self).y(a) } - fn w (&self, a: XYWH) -> O::Unit { (**self).w(a) } - fn w_min (&self, a: XYWH) -> O::Unit { (**self).w_min(a) } - fn w_max (&self, a: XYWH) -> O::Unit { (**self).w_max(a) } - fn h (&self, a: XYWH) -> O::Unit { (**self).h(a) } - fn h_min (&self, a: XYWH) -> O::Unit { (**self).h_min(a) } - fn h_max (&self, a: XYWH) -> O::Unit { (**self).h_max(a) } + fn layout_x (&self, a: XYWH) -> O::Unit { (**self).layout_x(a) } + fn layout_y (&self, a: XYWH) -> O::Unit { (**self).layout_y(a) } + fn layout_w (&self, a: XYWH) -> O::Unit { (**self).layout_w(a) } + fn layout_w_min (&self, a: XYWH) -> O::Unit { (**self).layout_w_min(a) } + fn layout_w_max (&self, a: XYWH) -> O::Unit { (**self).layout_w_max(a) } + fn layout_h (&self, a: XYWH) -> O::Unit { (**self).layout_h(a) } + fn layout_h_min (&self, a: XYWH) -> O::Unit { (**self).layout_h_min(a) } + fn layout_h_max (&self, a: XYWH) -> O::Unit { (**self).layout_h_max(a) } fn layout (&self, a: XYWH) -> XYWH { (**self).layout(a) } } impl Layout for Box> { - fn x (&self, a: XYWH) -> O::Unit { (**self).x(a) } - fn y (&self, a: XYWH) -> O::Unit { (**self).y(a) } - fn w (&self, a: XYWH) -> O::Unit { (**self).w(a) } - fn w_min (&self, a: XYWH) -> O::Unit { (**self).w_min(a) } - fn w_max (&self, a: XYWH) -> O::Unit { (**self).w_max(a) } - fn h (&self, a: XYWH) -> O::Unit { (**self).h(a) } - fn h_min (&self, a: XYWH) -> O::Unit { (**self).h_min(a) } - fn h_max (&self, a: XYWH) -> O::Unit { (**self).h_max(a) } + fn layout_x (&self, a: XYWH) -> O::Unit { (**self).layout_x(a) } + fn layout_y (&self, a: XYWH) -> O::Unit { (**self).layout_y(a) } + fn layout_w (&self, a: XYWH) -> O::Unit { (**self).layout_w(a) } + fn layout_w_min (&self, a: XYWH) -> O::Unit { (**self).layout_w_min(a) } + fn layout_w_max (&self, a: XYWH) -> O::Unit { (**self).layout_w_max(a) } + fn layout_h (&self, a: XYWH) -> O::Unit { (**self).layout_h(a) } + fn layout_h_min (&self, a: XYWH) -> O::Unit { (**self).layout_h_min(a) } + fn layout_h_max (&self, a: XYWH) -> O::Unit { (**self).layout_h_max(a) } fn layout (&self, a: XYWH) -> XYWH { (**self).layout(a) } } impl> Layout for RwLock { - fn x (&self, a: XYWH) -> O::Unit { self.read().unwrap().x(a) } - fn y (&self, a: XYWH) -> O::Unit { self.read().unwrap().y(a) } - fn w (&self, a: XYWH) -> O::Unit { self.read().unwrap().w(a) } - fn w_min (&self, a: XYWH) -> O::Unit { self.read().unwrap().w_min(a) } - fn w_max (&self, a: XYWH) -> O::Unit { self.read().unwrap().w_max(a) } - fn h (&self, a: XYWH) -> O::Unit { self.read().unwrap().h(a) } - fn h_min (&self, a: XYWH) -> O::Unit { self.read().unwrap().h_min(a) } - fn h_max (&self, a: XYWH) -> O::Unit { self.read().unwrap().h_max(a) } + fn layout_x (&self, a: XYWH) -> O::Unit { self.read().unwrap().layout_x(a) } + fn layout_y (&self, a: XYWH) -> O::Unit { self.read().unwrap().layout_y(a) } + fn layout_w (&self, a: XYWH) -> O::Unit { self.read().unwrap().layout_w(a) } + fn layout_w_min (&self, a: XYWH) -> O::Unit { self.read().unwrap().layout_w_min(a) } + fn layout_w_max (&self, a: XYWH) -> O::Unit { self.read().unwrap().layout_w_max(a) } + fn layout_h (&self, a: XYWH) -> O::Unit { self.read().unwrap().layout_h(a) } + fn layout_h_min (&self, a: XYWH) -> O::Unit { self.read().unwrap().layout_h_min(a) } + fn layout_h_max (&self, a: XYWH) -> O::Unit { self.read().unwrap().layout_h_max(a) } fn layout (&self, a: XYWH) -> XYWH { self.read().unwrap().layout(a) } } impl> Layout for Option { - fn x (&self, to: XYWH) -> O::Unit { self.as_ref().map(|c|c.x(to)).unwrap_or(to.x()) } - fn y (&self, to: XYWH) -> O::Unit { self.as_ref().map(|c|c.y(to)).unwrap_or(to.y()) } - fn w_min (&self, to: XYWH) -> O::Unit { self.as_ref().map(|c|c.w_min(to)).unwrap_or(0.into()) } - fn w_max (&self, to: XYWH) -> O::Unit { self.as_ref().map(|c|c.w_max(to)).unwrap_or(0.into()) } - fn w (&self, to: XYWH) -> O::Unit { self.as_ref().map(|c|c.w(to)).unwrap_or(0.into()) } - fn h_min (&self, to: XYWH) -> O::Unit { self.as_ref().map(|c|c.h_min(to)).unwrap_or(0.into()) } - fn h_max (&self, to: XYWH) -> O::Unit { self.as_ref().map(|c|c.h_max(to)).unwrap_or(0.into()) } - fn h (&self, to: XYWH) -> O::Unit { self.as_ref().map(|c|c.h(to)).unwrap_or(0.into()) } + fn layout_x (&self, to: XYWH) -> O::Unit { self.as_ref().map(|c|c.layout_x(to)).unwrap_or(to.x()) } + fn layout_y (&self, to: XYWH) -> O::Unit { self.as_ref().map(|c|c.layout_y(to)).unwrap_or(to.y()) } + fn layout_w_min (&self, to: XYWH) -> O::Unit { self.as_ref().map(|c|c.layout_w_min(to)).unwrap_or(0.into()) } + fn layout_w_max (&self, to: XYWH) -> O::Unit { self.as_ref().map(|c|c.layout_w_max(to)).unwrap_or(0.into()) } + fn layout_w (&self, to: XYWH) -> O::Unit { self.as_ref().map(|c|c.layout_w(to)).unwrap_or(0.into()) } + fn layout_h_min (&self, to: XYWH) -> O::Unit { self.as_ref().map(|c|c.layout_h_min(to)).unwrap_or(0.into()) } + fn layout_h_max (&self, to: XYWH) -> O::Unit { self.as_ref().map(|c|c.layout_h_max(to)).unwrap_or(0.into()) } + fn layout_h (&self, to: XYWH) -> O::Unit { self.as_ref().map(|c|c.layout_h(to)).unwrap_or(0.into()) } fn layout (&self, to: XYWH) -> XYWH { - self.as_ref() - .map(|c|c.layout(XYWH(self.x(to), self.y(to), self.w(to), self.h(to)).into())) - .unwrap_or(XYWH(to.x(), to.y(), 0.into(), 0.into())) + let xywh = XYWH(self.layout_x(to), self.layout_y(to), self.layout_w(to), self.layout_h(to)); + self.as_ref().map(|c|c.layout(xywh)).unwrap_or(XYWH(to.x(), to.y(), 0.into(), 0.into())) } } @@ -405,14 +404,14 @@ push_pull!(Pull: minus); layout_op_xy!(0: Fill); impl> Layout for Fill { - fn x (&self, area: XYWH) -> O::Unit { if self.dx() { area.x() } else { self.inner().x(area) } } - fn y (&self, area: XYWH) -> O::Unit { if self.dy() { area.y() } else { self.inner().y(area) } } - fn w (&self, area: XYWH) -> O::Unit { if self.dx() { area.w() } else { self.inner().w(area) } } - fn w_min (&self, area: XYWH) -> O::Unit { if self.dx() { area.w() } else { self.inner().w_min(area) } } - fn w_max (&self, area: XYWH) -> O::Unit { if self.dx() { area.w() } else { self.inner().w_max(area) } } - fn h (&self, area: XYWH) -> O::Unit { if self.dy() { area.h() } else { self.inner().h(area) } } - fn h_min (&self, area: XYWH) -> O::Unit { if self.dy() { area.h() } else { self.inner().h_min(area) } } - fn h_max (&self, area: XYWH) -> O::Unit { if self.dy() { area.h() } else { self.inner().h_max(area) } } + fn layout_x (&self, area: XYWH) -> O::Unit { if self.dx() { area.x() } else { self.inner().layout_x(area) } } + fn layout_y (&self, area: XYWH) -> O::Unit { if self.dy() { area.y() } else { self.inner().layout_y(area) } } + fn layout_w (&self, area: XYWH) -> O::Unit { if self.dx() { area.w() } else { self.inner().layout_w(area) } } + fn layout_w_min (&self, area: XYWH) -> O::Unit { if self.dx() { area.w() } else { self.inner().layout_w_min(area) } } + fn layout_w_max (&self, area: XYWH) -> O::Unit { if self.dx() { area.w() } else { self.inner().layout_w_max(area) } } + fn layout_h (&self, area: XYWH) -> O::Unit { if self.dy() { area.h() } else { self.inner().layout_h(area) } } + fn layout_h_min (&self, area: XYWH) -> O::Unit { if self.dy() { area.h() } else { self.inner().layout_h_min(area) } } + fn layout_h_max (&self, area: XYWH) -> O::Unit { if self.dy() { area.h() } else { self.inner().layout_h_max(area) } } } impl Fill { @@ -423,12 +422,12 @@ impl Fill { layout_op_xy!(1 opt: Fixed); impl> Layout for Fixed { - fn w (&self, area: XYWH) -> O::Unit { self.dx().unwrap_or(self.inner().w(area)) } - fn w_min (&self, area: XYWH) -> O::Unit { self.dx().unwrap_or(self.inner().w_min(area)) } - fn w_max (&self, area: XYWH) -> O::Unit { self.dx().unwrap_or(self.inner().w_max(area)) } - fn h (&self, area: XYWH) -> O::Unit { self.dy().unwrap_or(self.inner().h(area)) } - fn h_min (&self, area: XYWH) -> O::Unit { self.dy().unwrap_or(self.inner().h_min(area)) } - fn h_max (&self, area: XYWH) -> O::Unit { self.dy().unwrap_or(self.inner().h_max(area)) } + fn layout_w (&self, area: XYWH) -> O::Unit { self.dx().unwrap_or(self.inner().layout_w(area)) } + fn layout_w_min (&self, area: XYWH) -> O::Unit { self.dx().unwrap_or(self.inner().layout_w_min(area)) } + fn layout_w_max (&self, area: XYWH) -> O::Unit { self.dx().unwrap_or(self.inner().layout_w_max(area)) } + fn layout_h (&self, area: XYWH) -> O::Unit { self.dy().unwrap_or(self.inner().layout_h(area)) } + fn layout_h_min (&self, area: XYWH) -> O::Unit { self.dy().unwrap_or(self.inner().layout_h_min(area)) } + fn layout_h_max (&self, area: XYWH) -> O::Unit { self.dy().unwrap_or(self.inner().layout_h_max(area)) } } layout_op_xy!(1 opt: Max); @@ -460,10 +459,10 @@ impl> Layout for Min { layout_op_xy!(1 opt: Expand); impl> Layout for Expand { - fn w (&self, to: XYWH) -> O::Unit { + fn layout_w (&self, to: XYWH) -> O::Unit { self.inner().w(to).plus(self.dx().unwrap_or_default()) } - fn h (&self, to: XYWH) -> O::Unit { + fn layout_h (&self, to: XYWH) -> O::Unit { self.inner().w(to).plus(self.dy().unwrap_or_default()) } } @@ -500,19 +499,19 @@ impl> Draw for Align { } impl> Layout for Align { - fn x (&self, to: XYWH) -> O::Unit { + fn layout_x (&self, to: XYWH) -> O::Unit { match self.0 { NW | W | SW => to.x(), - N | Center | S => to.x().plus(to.w() / 2.into()).minus(self.1.w(to) / 2.into()), - NE | E | SE => to.x().plus(to.w()).minus(self.1.w(to)), + N | Center | S => to.x().plus(to.w() / 2.into()).minus(self.1.layout_w(to) / 2.into()), + NE | E | SE => to.x().plus(to.w()).minus(self.1.layout_w(to)), _ => todo!(), } } - fn y (&self, to: XYWH) -> O::Unit { + fn layout_y (&self, to: XYWH) -> O::Unit { match self.0 { NW | N | NE => to.y(), - W | Center | E => to.y().plus(to.h() / 2.into()).minus(self.1.h(to) / 2.into()), - SW | S | SE => to.y().plus(to.h()).minus(self.1.h(to)), + W | Center | E => to.y().plus(to.h() / 2.into()).minus(self.1.layout_h(to) / 2.into()), + SW | S | SE => to.y().plus(to.h()).minus(self.1.layout_h(to)), _ => todo!(), } } @@ -541,10 +540,10 @@ impl> Draw for Pad { } impl> Layout for Pad { - fn x (&self, area: XYWH) -> O::Unit { area.x().plus(self.dx()) } - fn y (&self, area: XYWH) -> O::Unit { area.x().plus(self.dx()) } - fn w (&self, area: XYWH) -> O::Unit { area.w().minus(self.dx() * 2.into()) } - fn h (&self, area: XYWH) -> O::Unit { area.h().minus(self.dy() * 2.into()) } + fn layout_x (&self, area: XYWH) -> O::Unit { area.x().plus(self.dx()) } + fn layout_y (&self, area: XYWH) -> O::Unit { area.x().plus(self.dx()) } + fn layout_w (&self, area: XYWH) -> O::Unit { area.w().minus(self.dx() * 2.into()) } + fn layout_h (&self, area: XYWH) -> O::Unit { area.h().minus(self.dy() * 2.into()) } } impl Bsp { @@ -585,23 +584,41 @@ impl, Tail: Content> Draw for Bsp { } impl, Tail: Layout> Layout for Bsp { - fn w (&self, area: XYWH) -> O::Unit { - match self.0 { Above | Below | North | South => self.1.w(area).max(self.2.w(area)), East | West => self.1.w_min(area).plus(self.2.w(area)), } + fn layout_w (&self, area: XYWH) -> O::Unit { + match self.0 { + Above | Below | North | South => self.1.layout_w(area).max(self.2.layout_w(area)), + East | West => self.1.layout_w_min(area).plus(self.2.layout_w(area)), + } } - fn w_min (&self, area: XYWH) -> O::Unit { - match self.0 { Above | Below | North | South => self.1.w_min(area).max(self.2.w_min(area)), East | West => self.1.w_min(area).plus(self.2.w_min(area)), } + fn layout_w_min (&self, area: XYWH) -> O::Unit { + match self.0 { + Above | Below | North | South => self.1.layout_w_min(area).max(self.2.layout_w_min(area)), + East | West => self.1.layout_w_min(area).plus(self.2.layout_w_min(area)), + } } - fn w_max (&self, area: XYWH) -> O::Unit { - match self.0 { Above | Below | North | South => self.1.w_max(area).max(self.2.w_max(area)), East | West => self.1.w_max(area).plus(self.2.w_max(area)), } + fn layout_w_max (&self, area: XYWH) -> O::Unit { + match self.0 { + Above | Below | North | South => self.1.layout_w_max(area).max(self.2.layout_w_max(area)), + East | West => self.1.layout_w_max(area).plus(self.2.layout_w_max(area)), + } } - fn h (&self, area: XYWH) -> O::Unit { - match self.0 { Above | Below | East | West => self.1.h(area).max(self.2.h(area)), North | South => self.1.h(area).plus(self.2.h(area)), } + fn layout_h (&self, area: XYWH) -> O::Unit { + match self.0 { + Above | Below | East | West => self.1.layout_h(area).max(self.2.layout_h(area)), + North | South => self.1.layout_h(area).plus(self.2.layout_h(area)), + } } - fn h_min (&self, area: XYWH) -> O::Unit { - match self.0 { Above | Below | East | West => self.1.h_min(area).max(self.2.h_min(area)), North | South => self.1.h_min(area).plus(self.2.h_min(area)), } + fn layout_h_min (&self, area: XYWH) -> O::Unit { + match self.0 { + Above | Below | East | West => self.1.layout_h_min(area).max(self.2.layout_h_min(area)), + North | South => self.1.layout_h_min(area).plus(self.2.layout_h_min(area)), + } } - fn h_max (&self, area: XYWH) -> O::Unit { - match self.0 { Above | Below | North | South => self.1.h_max(area).max(self.2.h_max(area)), East | West => self.1.h_max(area).plus(self.2.h_max(area)), } + fn layout_h_max (&self, area: XYWH) -> O::Unit { + match self.0 { + Above | Below | North | South => self.1.layout_h_max(area).max(self.2.layout_h_max(area)), + East | West => self.1.layout_h_max(area).plus(self.2.layout_h_max(area)), + } } fn layout (&self, area: XYWH) -> XYWH { bsp_areas(area, self.0, &self.1, &self.2)[2] diff --git a/output/src/out_traits.rs b/output/src/out_traits.rs index 39abe19..3ce8211 100644 --- a/output/src/out_traits.rs +++ b/output/src/out_traits.rs @@ -73,16 +73,16 @@ pub trait Lay: Sized {} /// Drawable area of display. pub trait Layout { - fn x (&self, to: XYWH) -> O::Unit { to.x() } - fn y (&self, to: XYWH) -> O::Unit { to.y() } - fn w_min (&self, _t: XYWH) -> O::Unit { 0.into() } - fn w_max (&self, to: XYWH) -> O::Unit { to.w() } - fn w (&self, to: XYWH) -> O::Unit { to.w().max(self.w_min(to)).min(self.w_max(to)) } - fn h_min (&self, _t: XYWH) -> O::Unit { 0.into() } - fn h_max (&self, to: XYWH) -> O::Unit { to.h() } - fn h (&self, to: XYWH) -> O::Unit { to.h().max(self.h_min(to)).min(self.h_max(to)) } + fn layout_x (&self, to: XYWH) -> O::Unit { to.x() } + fn layout_y (&self, to: XYWH) -> O::Unit { to.y() } + fn layout_w_min (&self, _t: XYWH) -> O::Unit { 0.into() } + fn layout_w_max (&self, to: XYWH) -> O::Unit { to.w() } + fn layout_w (&self, to: XYWH) -> O::Unit { to.w().max(self.layout_w_min(to)).min(self.layout_w_max(to)) } + fn layout_h_min (&self, _t: XYWH) -> O::Unit { 0.into() } + fn layout_h_max (&self, to: XYWH) -> O::Unit { to.h() } + fn layout_h (&self, to: XYWH) -> O::Unit { to.h().max(self.layout_h_min(to)).min(self.layout_h_max(to)) } fn layout (&self, to: XYWH) -> XYWH { - XYWH(self.x(to), self.y(to), self.w(to), self.h(to)) + XYWH(self.layout_x(to), self.layout_y(to), self.layout_w(to), self.layout_h(to)) } }