From 41fa55fa6ca15abd0a80fd50a30326b1fea6b5f1 Mon Sep 17 00:00:00 2001 From: unspeaker Date: Tue, 9 Sep 2025 20:59:07 +0300 Subject: [PATCH] fix: impl Layout for Measure --- output/src/space/space_measure.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/output/src/space/space_measure.rs b/output/src/space/space_measure.rs index f508554..b785bdb 100644 --- a/output/src/space/space_measure.rs +++ b/output/src/space/space_measure.rs @@ -2,28 +2,30 @@ use crate::*; /// A widget that tracks its render width and height #[derive(Default)] -pub struct Measure { - _engine: PhantomData, +pub struct Measure { + _engine: PhantomData, pub x: Arc, pub y: Arc, } -impl PartialEq for Measure { +impl PartialEq for Measure { fn eq (&self, other: &Self) -> bool { self.x.load(Relaxed) == other.x.load(Relaxed) && self.y.load(Relaxed) == other.y.load(Relaxed) } } +impl Layout for Measure {} + // TODO: 🡘 🡙 ←🡙→ indicator to expand window when too small -impl Draw for Measure { - fn draw (&self, to: &mut E) { +impl Draw for Measure { + fn draw (&self, to: &mut O) { self.x.store(to.area().w().into(), Relaxed); self.y.store(to.area().h().into(), Relaxed); } } -impl Clone for Measure { +impl Clone for Measure { fn clone (&self) -> Self { Self { _engine: Default::default(), @@ -33,7 +35,7 @@ impl Clone for Measure { } } -impl std::fmt::Debug for Measure { +impl std::fmt::Debug for Measure { fn fmt (&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { f.debug_struct("Measure") .field("width", &self.x) @@ -42,7 +44,7 @@ impl std::fmt::Debug for Measure { } } -impl Measure { +impl Measure { pub fn new () -> Self { Self { _engine: PhantomData::default(), @@ -75,7 +77,7 @@ impl Measure { pub fn format (&self) -> Arc { format!("{}x{}", self.w(), self.h()).into() } - pub fn of > (&self, item: T) -> Bsp, T> { + pub fn of > (&self, item: T) -> Bsp, T> { Bsp::b(Fill::XY(self), item) } }