Skip to main content

View

Trait View 

Source
pub trait View: Sized + 'static {
    // Required method
    fn render(&mut self, cx: &mut ViewContext<'_, Self>) -> impl IntoElement;

    // Provided methods
    fn event(&mut self, _event: &Event, _cx: &mut EventContext) { ... }
    fn render_scope(
        &mut self,
        _id: ElementId,
        _cx: &mut ViewContext<'_, Self>,
    ) -> Option<Element> { ... }
}
Expand description

A retained application view. It is only rendered after explicit invalidation or OS damage.

Required Methods§

Source

fn render(&mut self, cx: &mut ViewContext<'_, Self>) -> impl IntoElement

Provided Methods§

Source

fn event(&mut self, _event: &Event, _cx: &mut EventContext)

Source

fn render_scope( &mut self, _id: ElementId, _cx: &mut ViewContext<'_, Self>, ) -> Option<Element>

Embedding renderers can rebuild a subtree declared with ViewContext::with_scope. Return None when a mutation needs an ordinary full declaration instead.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§