diff options
Diffstat (limited to 'src/layout/mod.rs')
| -rw-r--r-- | src/layout/mod.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 14aa6417..abf140d6 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -76,6 +76,11 @@ impl MultiLayout { self.layouts.push(layout); } + /// The count of sublayouts. + pub fn count(&self) -> usize { + self.layouts.len() + } + /// Whether this layout contains any sublayouts. pub fn is_empty(&self) -> bool { self.layouts.is_empty() @@ -91,6 +96,16 @@ impl IntoIterator for MultiLayout { } } +impl<'a> IntoIterator for &'a MultiLayout { + type Item = &'a Layout; + type IntoIter = std::slice::Iter<'a, Layout>; + + fn into_iter(self) -> Self::IntoIter { + self.layouts.iter() + } +} + + /// The context for layouting. #[derive(Copy, Clone)] pub struct LayoutContext<'a, 'p> { |
