I love control flow

This commit is contained in:
2025-11-20 22:48:08 -05:00
parent f6f9ebbe51
commit dff72d2c43
19 changed files with 126 additions and 63 deletions

View File

@@ -29,6 +29,12 @@ impl<Nx: UiNum, Ny: UiNum> From<(Nx, Ny)> for Size {
}
}
impl From<Len> for Size {
fn from(value: Len) -> Self {
Self { x: value, y: value }
}
}
impl Size {
pub const ZERO: Self = Self {
x: Len::ZERO,
@@ -171,10 +177,10 @@ impl std::fmt::Display for Len {
write!(f, "{} abs;", self.abs)?;
}
if self.rel != 0.0 {
write!(f, "{} rel;", self.abs)?;
write!(f, "{} rel;", self.rel)?;
}
if self.rest != 0.0 {
write!(f, "{} leftover;", self.abs)?;
write!(f, "{} rest;", self.rest)?;
}
Ok(())
}