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 <noreply@anthropic.com>
This commit is contained in:
iris-aiandClaude Opus 5 committed 2026-09-19 21:53:58 -04:00
1 parent 4d42f1c8ca
commit 40b89c1f79
4 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -648,7 +648,7 @@ impl Widgets {
pub(crate) fn declared_lens(&self, id: WidgetId) -> Declared { pub(crate) fn declared_lens(&self, id: WidgetId) -> Declared {
let rules = self.size_rules(id); let rules = self.size_rules(id);
let widget = self.get_dyn(id); let widget = self.get_dyn(id);
Declared::per_axis(|axis| { Declared::from_axes(|axis| {
rules[axis].declared().or_else(|| { rules[axis].declared().or_else(|| {
// A hint still narrows the box where no rule does, which is // A hint still narrows the box where no rule does, which is
// how a widget with a natural pixel size -- an image, a gap // how a widget with a natural pixel size -- an image, a gap
+1 -1
View File
@@ -147,7 +147,7 @@ impl PlaceDesc {
/// A description per axis, where the two differ and neither is the /// A description per axis, where the two differ and neither is the
/// axis a container divides. /// 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)) Self::new(f(Axis::X), f(Axis::Y))
} }
+1 -1
View File
@@ -83,7 +83,7 @@ pub struct Declared {
impl Declared { impl Declared {
pub const NONE: Self = Self { x: None, y: None }; pub const NONE: Self = Self { x: None, y: None };
pub fn per_axis(f: impl Fn(Axis) -> Option<Len>) -> Self { pub fn from_axes(f: impl Fn(Axis) -> Option<Len>) -> Self {
Self { Self {
x: f(Axis::X), x: f(Axis::X),
y: f(Axis::Y), y: f(Axis::Y),
+1 -1
View File
@@ -31,7 +31,7 @@ impl Widget for Stack {
// fraction under them is a fraction of it. A share leaves the axis // 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 // to whoever gave the stack its box. Where a child sits in a box
// bigger than itself is its own business. // bigger than itself is its own business.
let place = PlaceDesc::per_axis(|axis| { let place = PlaceDesc::from_axes(|axis| {
let len = size[axis]; let len = size[axis];
match len.leftover == Weight::ZERO { match len.leftover == Weight::ZERO {
true => len.without_leftover().as_desc().fills(), true => len.without_leftover().as_desc().fills(),