pub trait AnyView<T> {
// Required methods
fn as_any(&self) -> &(dyn Any + 'static);
fn dyn_build(
&mut self,
cx: &mut BuildCx<'_, '_>,
data: &mut T,
) -> Box<dyn Any>;
fn dyn_rebuild(
&mut self,
state: &mut Box<dyn Any>,
cx: &mut RebuildCx<'_, '_>,
data: &mut T,
old: &dyn AnyView<T>,
);
fn dyn_event(
&mut self,
state: &mut Box<dyn Any>,
cx: &mut EventCx<'_, '_>,
data: &mut T,
event: &Event,
) -> bool;
fn dyn_layout(
&mut self,
state: &mut Box<dyn Any>,
cx: &mut LayoutCx<'_, '_>,
data: &mut T,
space: Space,
) -> Size;
fn dyn_draw(
&mut self,
state: &mut Box<dyn Any>,
cx: &mut DrawCx<'_, '_>,
data: &mut T,
);
}
Expand description
A view that supports dynamic dispatch.
Required Methods§
Sourcefn dyn_build(&mut self, cx: &mut BuildCx<'_, '_>, data: &mut T) -> Box<dyn Any>
fn dyn_build(&mut self, cx: &mut BuildCx<'_, '_>, data: &mut T) -> Box<dyn Any>
Build the view.
Sourcefn dyn_rebuild(
&mut self,
state: &mut Box<dyn Any>,
cx: &mut RebuildCx<'_, '_>,
data: &mut T,
old: &dyn AnyView<T>,
)
fn dyn_rebuild( &mut self, state: &mut Box<dyn Any>, cx: &mut RebuildCx<'_, '_>, data: &mut T, old: &dyn AnyView<T>, )
Rebuild the view.
Sourcefn dyn_event(
&mut self,
state: &mut Box<dyn Any>,
cx: &mut EventCx<'_, '_>,
data: &mut T,
event: &Event,
) -> bool
fn dyn_event( &mut self, state: &mut Box<dyn Any>, cx: &mut EventCx<'_, '_>, data: &mut T, event: &Event, ) -> bool
Handle an event.
Trait Implementations§
Source§impl<T> View<T> for Box<dyn AnyView<T>>
impl<T> View<T> for Box<dyn AnyView<T>>
Source§type State = Box<dyn Any>
type State = Box<dyn Any>
The state of the view, see top-level documentation for more information.
Source§fn build(
&mut self,
cx: &mut BuildCx<'_, '_>,
data: &mut T,
) -> <Box<dyn AnyView<T>> as View<T>>::State
fn build( &mut self, cx: &mut BuildCx<'_, '_>, data: &mut T, ) -> <Box<dyn AnyView<T>> as View<T>>::State
Build the view state, see top-level documentation for more information.
Source§fn rebuild(
&mut self,
state: &mut <Box<dyn AnyView<T>> as View<T>>::State,
cx: &mut RebuildCx<'_, '_>,
data: &mut T,
old: &Box<dyn AnyView<T>>,
)
fn rebuild( &mut self, state: &mut <Box<dyn AnyView<T>> as View<T>>::State, cx: &mut RebuildCx<'_, '_>, data: &mut T, old: &Box<dyn AnyView<T>>, )
Rebuild the view state, see top-level documentation for more information.
Source§fn event(
&mut self,
state: &mut <Box<dyn AnyView<T>> as View<T>>::State,
cx: &mut EventCx<'_, '_>,
data: &mut T,
event: &Event,
) -> bool
fn event( &mut self, state: &mut <Box<dyn AnyView<T>> as View<T>>::State, cx: &mut EventCx<'_, '_>, data: &mut T, event: &Event, ) -> bool
Handle an event, see top-level documentation for more information.