Skip to main content

CustomWidget

Trait CustomWidget 

Source
pub trait CustomWidget: Sized + 'static {
    type Props: Clone + PartialEq + Debug + 'static;
    type Event: Clone + PartialEq + Debug + 'static;

    const NAME: &'static str;

    // Required method
    fn a11y(props: &Self::Props) -> A11yProps;

    // Provided method
    fn action(props: &Self::Props, action: &A11yAction) -> Option<Self::Event> { ... }
}
Expand description

The shared, platform-free definition of a custom widget.

Required Associated Constants§

Source

const NAME: &'static str

Shown in trees, logs and snapshots.

Required Associated Types§

Source

type Props: Clone + PartialEq + Debug + 'static

Source

type Event: Clone + PartialEq + Debug + 'static

Required Methods§

Source

fn a11y(props: &Self::Props) -> A11yProps

Semantics, shared by every render. Apps can still override the label and description where they use the widget.

Provided Methods§

Source

fn action(props: &Self::Props, action: &A11yAction) -> Option<Self::Event>

What an accessibility action (increment, set value, …) means for this widget. Used unless the native render performs it itself.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§