Skip to main content

WidgetCore

Trait WidgetCore 

Source
pub trait WidgetCore: Default {
    // Required method
    fn id_ref(&self) -> &Id;

    // Provided method
    fn id(&self) -> Id { ... }
}
Expand description

Operations supported by a widget core

Required Methods§

Source

fn id_ref(&self) -> &Id

Get a reference to the widget’s identifier

The widget identifier is assigned when the widget is configured (see Events). In case the Id is accessed before this, it will be invalid. The identifier may change when widgets which are descendants of some dynamic layout are reconfigured.

Provided Methods§

Source

fn id(&self) -> Id

Get the widget’s identifier

This method returns a Clone of Self::id_ref. Since cloning an Id is very cheap, this can mostly be ignored.

The widget identifier is assigned when the widget is configured (see Events). In case the Id is accessed before this, it will be invalid. The identifier may change when widgets which are descendants of some dynamic layout are reconfigured.

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.

Implementors§