From 9f0bbf6020146d16521dd301b925f710d85dc92d Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 19 Feb 2024 08:42:58 +0100 Subject: Add `extend` method to `Column` and `Row` --- widget/src/row.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'widget/src/row.rs') diff --git a/widget/src/row.rs b/widget/src/row.rs index 20b47a41..4ad806ed 100644 --- a/widget/src/row.rs +++ b/widget/src/row.rs @@ -43,7 +43,7 @@ where pub fn with_children( children: impl IntoIterator>, ) -> Self { - children.into_iter().fold(Self::new(), Self::push) + Self::new().extend(children) } /// Sets the horizontal spacing _between_ elements. @@ -118,6 +118,14 @@ where self } } + + /// Extends the [`Row`] with the given children. + pub fn extend( + self, + children: impl IntoIterator>, + ) -> Self { + children.into_iter().fold(self, Self::push) + } } impl<'a, Message, Renderer> Default for Row<'a, Message, Renderer> -- cgit