Trait Described
pub trait Described:
Sized
+ Widget
+ 'static {
type Props: Component;
// Required method
fn from_props(key: &str, props: Self::Props) -> Self;
// Provided methods
fn set_props(&mut self, props: Self::Props) -> bool { ... }
fn slot_views(&mut self, slot: &str) -> Option<&mut dyn SlotViews> { ... }
fn part_views(
&mut self,
slot: &str,
key: &str,
of: &str,
) -> Option<&mut dyn SlotViews> { ... }
}Expand description
A widget made from props.
A described widget answers its own type through crate::widget::Widget::as_any_mut: the
adapter reaches it with that to change its props in place, and a widget that answers no
type is built again on every change it is told about. Declare the answer inside its
Widget impl with crate::described!.
Required Associated Types§
Required Methods§
fn from_props(key: &str, props: Self::Props) -> Self
fn from_props(key: &str, props: Self::Props) -> Self
The widget of props, with key its stable id.
Provided Methods§
fn set_props(&mut self, props: Self::Props) -> bool
fn set_props(&mut self, props: Self::Props) -> bool
Take changed props in place, damaging what they change: false when this widget cannot
and is to be built again.
fn slot_views(&mut self, slot: &str) -> Option<&mut dyn SlotViews>
fn slot_views(&mut self, slot: &str) -> Option<&mut dyn SlotViews>
The views of its slot slot, to change by key in place: None when a change of what
the slot holds builds the widget again.
fn part_views(
&mut self,
slot: &str,
key: &str,
of: &str,
) -> Option<&mut dyn SlotViews>
fn part_views( &mut self, slot: &str, key: &str, of: &str, ) -> Option<&mut dyn SlotViews>
The views its slot slot holds for the part key — a part being a component the slot
takes, whose props the widget reads — in that part’s own view slot of, to change them
by key where they stand. None when a change inside a part builds the widget again.
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.