Skip to main content

BaseControl

Trait BaseControl 

Source
pub trait BaseControl: Send + ControlAsAny {
    // Required methods
    fn clone_boxed(&self) -> Box<dyn Control<Target = Widget>>;
    fn type_name(&self) -> &'static str;
    fn id(&self) -> Uuid;
    fn self_size(&self) -> usize;
}
Expand description

Base trait for all UI widgets. It has auto-impl, and you don’t need to implement it manually. Your widget must implement Clone and Control traits for impl to be generated for you, also your widget must not contain any references (due to 'static lifetime requirement).

Required Methods§

Source

fn clone_boxed(&self) -> Box<dyn Control<Target = Widget>>

Returns the exact copy of the widget in “type-erased” form.

Source

fn type_name(&self) -> &'static str

Returns type name of the widget.

Source

fn id(&self) -> Uuid

Source

fn self_size(&self) -> usize

Returns the total amount of memory used by this widget (in bytes), in other words, it returns size_of::<WidgetType>().

Implementors§

Source§

impl<T> BaseControl for T
where T: Any + Clone + 'static + Control + TypeUuidProvider,