pub trait UiView<'text, ViewId, Message, const N: usize> {
// Required methods
fn configure(
&mut self,
registration: &mut ViewRegistration<'text, ViewId, N>,
);
fn handle_touch(
&mut self,
touch: TouchEvent,
registration: &ViewRegistration<'text, ViewId, N>,
env: &ViewEnvironment<'_, 'text>,
) -> ViewEvent<Message>;
fn draw<D>(
&self,
display: &mut D,
registration: &ViewRegistration<'text, ViewId, N>,
env: &ViewEnvironment<'_, 'text>,
)
where D: UiCanvas;
// Provided method
fn update(
&mut self,
_dt_ms: u32,
_registration: &ViewRegistration<'text, ViewId, N>,
_env: &ViewEnvironment<'_, 'text>,
) -> ViewEvent<Message> { ... }
}Expand description
Root contract implemented by application-defined views.
Required Methods§
Sourcefn configure(&mut self, registration: &mut ViewRegistration<'text, ViewId, N>)
fn configure(&mut self, registration: &mut ViewRegistration<'text, ViewId, N>)
Declares the view frame, title, and child hierarchy.
Sourcefn handle_touch(
&mut self,
touch: TouchEvent,
registration: &ViewRegistration<'text, ViewId, N>,
env: &ViewEnvironment<'_, 'text>,
) -> ViewEvent<Message>
fn handle_touch( &mut self, touch: TouchEvent, registration: &ViewRegistration<'text, ViewId, N>, env: &ViewEnvironment<'_, 'text>, ) -> ViewEvent<Message>
Handles a touch event routed to the view tree.
Sourcefn draw<D>(
&self,
display: &mut D,
registration: &ViewRegistration<'text, ViewId, N>,
env: &ViewEnvironment<'_, 'text>,
)where
D: UiCanvas,
fn draw<D>(
&self,
display: &mut D,
registration: &ViewRegistration<'text, ViewId, N>,
env: &ViewEnvironment<'_, 'text>,
)where
D: UiCanvas,
Draws the current view state.
Provided Methods§
Sourcefn update(
&mut self,
_dt_ms: u32,
_registration: &ViewRegistration<'text, ViewId, N>,
_env: &ViewEnvironment<'_, 'text>,
) -> ViewEvent<Message>
fn update( &mut self, _dt_ms: u32, _registration: &ViewRegistration<'text, ViewId, N>, _env: &ViewEnvironment<'_, 'text>, ) -> ViewEvent<Message>
Advances internal state and returns any redraw or message output.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.