From 40b89c1f79b8ac026592a1e39def449274b3e4fc Mon Sep 17 00:00:00 2001 From: iris-ai <4+iris-ai@noreply.localhost> Date: Sat, 19 Sep 2026 21:53:58 -0400 Subject: [PATCH] Say from_axes, which is what a constructor is called `per_axis` on `PlaceDesc` and `Declared` builds a pair by asking for each axis. `from_axis` beside it already names the three-argument form, so the plural is the one that takes a function, and both follow Rust's convention for a constructor rather than an invented word. Co-Authored-By: Claude Opus 5 --- core/src/ui/painter.rs | 2 +- core/src/ui/place.rs | 2 +- core/src/widget/size_rule.rs | 2 +- src/widget/position/stack.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/ui/painter.rs b/core/src/ui/painter.rs index ec3993e..c2dc94f 100644 --- a/core/src/ui/painter.rs +++ b/core/src/ui/painter.rs @@ -648,7 +648,7 @@ impl Widgets { pub(crate) fn declared_lens(&self, id: WidgetId) -> Declared { let rules = self.size_rules(id); let widget = self.get_dyn(id); - Declared::per_axis(|axis| { + Declared::from_axes(|axis| { rules[axis].declared().or_else(|| { // A hint still narrows the box where no rule does, which is // how a widget with a natural pixel size -- an image, a gap diff --git a/core/src/ui/place.rs b/core/src/ui/place.rs index c821d91..fe51d64 100644 --- a/core/src/ui/place.rs +++ b/core/src/ui/place.rs @@ -147,7 +147,7 @@ impl PlaceDesc { /// A description per axis, where the two differ and neither is the /// axis a container divides. - pub fn per_axis(f: impl Fn(Axis) -> PlaceDescAxis) -> Self { + pub fn from_axes(f: impl Fn(Axis) -> PlaceDescAxis) -> Self { Self::new(f(Axis::X), f(Axis::Y)) } diff --git a/core/src/widget/size_rule.rs b/core/src/widget/size_rule.rs index 728a107..fee56af 100644 --- a/core/src/widget/size_rule.rs +++ b/core/src/widget/size_rule.rs @@ -83,7 +83,7 @@ pub struct Declared { impl Declared { pub const NONE: Self = Self { x: None, y: None }; - pub fn per_axis(f: impl Fn(Axis) -> Option) -> Self { + pub fn from_axes(f: impl Fn(Axis) -> Option) -> Self { Self { x: f(Axis::X), y: f(Axis::Y), diff --git a/src/widget/position/stack.rs b/src/widget/position/stack.rs index a5a6323..4e5639f 100644 --- a/src/widget/position/stack.rs +++ b/src/widget/position/stack.rs @@ -31,7 +31,7 @@ impl Widget for Stack { // fraction under them is a fraction of it. A share leaves the axis // to whoever gave the stack its box. Where a child sits in a box // bigger than itself is its own business. - let place = PlaceDesc::per_axis(|axis| { + let place = PlaceDesc::from_axes(|axis| { let len = size[axis]; match len.leftover == Weight::ZERO { true => len.without_leftover().as_desc().fills(),