diff --git a/examples/component/src/main.rs b/examples/component/src/main.rs index 58d3f354e8..39335cf119 100644 --- a/examples/component/src/main.rs +++ b/examples/component/src/main.rs @@ -174,7 +174,7 @@ mod numeric_input { Renderer: text::Renderer + 'a, { fn from(numeric_input: NumericInput<'a, Message>) -> Self { - component::view(Box::new(numeric_input)) + component::view(numeric_input) } } } diff --git a/lazy/src/component.rs b/lazy/src/component.rs index 04832d9dcc..6d57a2a943 100644 --- a/lazy/src/component.rs +++ b/lazy/src/component.rs @@ -10,18 +10,18 @@ use iced_native::{ use ouroboros::self_referencing; use std::marker::PhantomData; -pub fn view<'a, Event, Message, Renderer>( - component: Box + 'a>, +pub fn view<'a, C, Message, Renderer>( + component: C, ) -> Element<'a, Message, Renderer> where + C: Component + 'a, Message: 'a, - Event: 'a, Renderer: iced_native::Renderer + 'a, { Element::new(Instance { state: Some( StateBuilder { - component, + component: Box::new(component), cache_builder: |state| Cache { element: state.view(), message: PhantomData,