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.
Its functions answer from their arguments alone. a11y,
Drawn::measure and Drawn::draw run while the Ui holds its
tree (building the accessibility tree, laying out, drawing), so one
that reaches a Ui (builds nodes, sets props, commits, reads a query)
panics with a RefCell borrow error. action and
Drawn::pointer run with the tree free, but their job is to return
an event, which the app handles in Custom::on_event.
Required Associated Constants§
Required Associated Types§
type Props: Clone + PartialEq + Debug + 'static
type Event: Clone + PartialEq + Debug + 'static
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".