Skip to content

Commit

Permalink
Allow no views as a valid View
Browse files Browse the repository at this point in the history
  • Loading branch information
bwoods committed Nov 28, 2024
1 parent 03e6cb8 commit 6d6e28a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions composable-views/src/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,21 @@ tuple_impl! { A B C D E F G H I J K L M N O P Q R S T U V W X }
tuple_impl! { A B C D E F G H I J K L M N O P Q R S T U V W X Y }
// up to 25 views are supported

// as is no views
impl View for () {
#[inline(always)]
fn size(&self) -> Size {
Size::zero()
}

#[inline(always)]
fn event(&self, event: Event, offset: Point, bounds: Bounds) {}

#[inline(always)]
fn draw(&self, bounds: Bounds, onto: &mut impl Output) {}
}


impl<T: View, const N: usize> View for Horizontal<[T; N]> {
#[inline]
fn size(&self) -> Size {
Expand Down

0 comments on commit 6d6e28a

Please sign in to comment.