Skip to main content

Widget

Trait Widget 

Source
pub trait Widget:
    Send
    + Sized
    + 'static {
    type State;
    type Message: Send + 'static;

    // Required method
    fn mount(&mut self, ctx: &mut MountCtx<Self>) -> Self::State;

    // Provided methods
    fn start(&mut self, _state: &mut Self::State, _ctx: &mut StartCtx<Self>) { ... }
    fn update(
        &mut self,
        _state: &mut Self::State,
        _event: Event<Self::Message>,
        _ctx: &mut UpdateCtx<Self>,
    ) { ... }
    fn render(
        &self,
        _state: &Self::State,
        _canvas: &mut Canvas,
        _ctx: &RenderCtx<Self>,
    ) { ... }
    fn stop(&mut self, _state: &mut Self::State, _ctx: &mut StopCtx<Self>) { ... }
    fn dispose(&mut self, _state: Self::State, _ctx: &mut DisposeCtx<Self>) { ... }
}

Required Associated Types§

Source

type State

Source

type Message: Send + 'static

Required Methods§

Source

fn mount(&mut self, ctx: &mut MountCtx<Self>) -> Self::State

Provided Methods§

Source

fn start(&mut self, _state: &mut Self::State, _ctx: &mut StartCtx<Self>)

Source

fn update( &mut self, _state: &mut Self::State, _event: Event<Self::Message>, _ctx: &mut UpdateCtx<Self>, )

Source

fn render( &self, _state: &Self::State, _canvas: &mut Canvas, _ctx: &RenderCtx<Self>, )

Source

fn stop(&mut self, _state: &mut Self::State, _ctx: &mut StopCtx<Self>)

Source

fn dispose(&mut self, _state: Self::State, _ctx: &mut DisposeCtx<Self>)

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.

Implementors§