pub trait Widget: Default + 'static {
type Event;
type Tag: Clone + Eq + Hash;
type Properties: Properties + PartialEq;
type Meta: Default;
// Required method
fn view(&self, ctx: &Context<Self>) -> Html;
// Provided methods
fn init(&mut self, _ctx: &mut Context<Self>) { ... }
fn on_props(&mut self, _ctx: &mut Context<Self>) { ... }
fn on_event(&mut self, _event: Self::Event, _ctx: &mut Context<Self>) { ... }
fn rendered(&mut self, _first: bool) -> Result<(), Error> { ... }
}
Required Associated Types§
type Event
type Tag: Clone + Eq + Hash
type Properties: Properties + PartialEq
type Meta: Default
Required Methods§
Provided Methods§
fn init(&mut self, _ctx: &mut Context<Self>)
fn on_props(&mut self, _ctx: &mut Context<Self>)
fn on_event(&mut self, _event: Self::Event, _ctx: &mut Context<Self>)
fn rendered(&mut self, _first: bool) -> Result<(), Error>
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.