From 6d6e28a3f0212559dcc50f96c9e9b993f80e462c Mon Sep 17 00:00:00 2001 From: Bryan Woods Date: Wed, 27 Nov 2024 21:14:23 -0800 Subject: [PATCH] Allow no views as a valid `View` --- composable-views/src/layout/mod.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/composable-views/src/layout/mod.rs b/composable-views/src/layout/mod.rs index 8a1a660..26e14f4 100644 --- a/composable-views/src/layout/mod.rs +++ b/composable-views/src/layout/mod.rs @@ -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 View for Horizontal<[T; N]> { #[inline] fn size(&self) -> Size {