pub struct WidgetId(pub u64);Expand description
Unique identifier for a widget instance.
Used as part of the cache key to distinguish between different widgets.
§Creating WidgetIds
§From pointer (stable for widget lifetime):
ⓘ
WidgetId::from_ptr(&my_widget)§From content hash (stable across recreations):
ⓘ
WidgetId::from_hash(&my_widget.text)§From arbitrary u64:
ⓘ
WidgetId(42)Tuple Fields§
§0: u64Implementations§
Source§impl WidgetId
impl WidgetId
Sourcepub fn from_ptr<T>(ptr: &T) -> Self
pub fn from_ptr<T>(ptr: &T) -> Self
Create a WidgetId from a memory address.
Stable for the lifetime of the widget. Use when the widget instance persists across multiple layout passes.
§Note
If the widget is recreated (e.g., in a loop), the pointer will change.
For such cases, prefer WidgetId::from_hash.
Trait Implementations§
impl Copy for WidgetId
impl Eq for WidgetId
impl StructuralPartialEq for WidgetId
Auto Trait Implementations§
impl Freeze for WidgetId
impl RefUnwindSafe for WidgetId
impl Send for WidgetId
impl Sync for WidgetId
impl Unpin for WidgetId
impl UnwindSafe for WidgetId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.