From 0b7e23444afb3f351cd947c52babb6b87f30381d Mon Sep 17 00:00:00 2001 From: Tony4dev <78384793+Tony4dev@users.noreply.github.com> Date: Thu, 13 Feb 2025 15:22:42 +0000 Subject: [PATCH] feat(segmented_button): add len method --- src/widget/segmented_button/model/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/widget/segmented_button/model/mod.rs b/src/widget/segmented_button/model/mod.rs index 449c829fb47..c24fe85f13a 100644 --- a/src/widget/segmented_button/model/mod.rs +++ b/src/widget/segmented_button/model/mod.rs @@ -310,6 +310,11 @@ where self.items.get(id).map_or(false, |e| e.enabled) } + /// Get number of items in the model. + pub fn len(&self) -> usize { + self.order.len() + } + /// Iterates across items in the model in the order that they are displayed. pub fn iter(&self) -> impl Iterator + '_ { self.order.iter().copied()