feat(segmented_button): add len method

This commit is contained in:
Tony4dev 2025-02-13 15:22:42 +00:00 committed by GitHub
parent cba28b1372
commit 0b7e23444a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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<Item = Entity> + '_ {
self.order.iter().copied()