[−][src]Struct druid::WidgetId
A unique identifier for a single Widget
.
WidgetId
s are generated automatically for all widgets that participate
in layout. More specifically, each WidgetPod
has a unique WidgetId
.
These ids are used internally to route events, and can be used to communicate
between widgets, by submitting a command (as with EventCtx::submit_command
)
and passing a WidgetId
as the Target
.
A widget can retrieve its id via methods on the various contexts, such as
LifeCycleCtx::widget_id
.
Explicit WidgetId
s.
Sometimes, you may want to know a widget's id when constructing the widget.
You can give a widget an explicit id by wrapping it in an IdentityWrapper
widget, or by using the WidgetExt::with_id
convenience method.
If you set a WidgetId
directly, you are resposible for ensuring that it
is unique in time. That is: only one widget can exist with a given id at a
given time.
Implementations
impl WidgetId
[src]
pub fn next() -> WidgetId
[src]
Allocate a new, unique WidgetId
.
All widgets are assigned ids automatically; you should only create an explicit id if you need to know it ahead of time, for instance if you want two sibling widgets to know each others' ids.
You must ensure that a given WidgetId
is only ever used for one
widget at a time.
pub const fn reserved(raw: u16) -> WidgetId
[src]
Create a reserved WidgetId
, suitable for reuse.
The caller is responsible for ensuring that this ID is in fact assigned to a single widget at any time, or your code may become haunted.
The actual inner representation of the returned WidgetId
will not
be the same as the raw value that is passed in; it will be
u64::max_value() - raw
.
Trait Implementations
impl Clone for WidgetId
[src]
impl Copy for WidgetId
[src]
impl Debug for WidgetId
[src]
impl Eq for WidgetId
[src]
impl From<WidgetId> for Target
[src]
impl Hash for WidgetId
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Into<Option<Target>> for WidgetId
[src]
impl PartialEq<WidgetId> for WidgetId
[src]
impl StructuralEq for WidgetId
[src]
impl StructuralPartialEq for WidgetId
[src]
Auto Trait Implementations
impl RefUnwindSafe for WidgetId
impl Send for WidgetId
impl Sync for WidgetId
impl Unpin for WidgetId
impl UnwindSafe for WidgetId
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AnyEq for T where
T: PartialEq<T> + Any,
[src]
T: PartialEq<T> + Any,
fn equals(&self, other: &(dyn Any + 'static)) -> bool
[src]
fn as_any(&self) -> &(dyn Any + 'static)
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> RoundFrom<T> for T
fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
fn round_into(self) -> U
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,