ElementRef
struct · ferroui-base · v0.5.0
struct ElementRef<T: ObjectType>
A reference to an element that the holder does not own: the value type of properties such as a placement target, the target of a label or the element an adorner adorns.
Such a property points sideways or up the tree — often at an ancestor of
the element it is set on — so holding the element strongly would make
the two keep each other alive. An ElementRef holds it weakly and
compares by identity. Classes expose these properties with getters that
return Option<Ref<T>> and setters that take impl Into<Nullable<T>>;
untyped access and bindings convert to and from Ref<T> (see
ValueTypes::register_element_ref).
When the referenced element is dropped the reference reads as nothing; no change notification is raised for that.
Members
new
fn new<U: ObjectType + Upcast<T>>(element: &Ref<U>) -> Self
Creates a reference to element.
of
fn of(element: &Ref<T>) -> Self
Creates a reference to an element of exactly class T.
from_nullable
fn from_nullable(element: Option<Ref<T>>) -> Option<Self>
The property value for an optional element.
get
fn get(self: &Self) -> Option<Ref<T>>
The referenced element, if it is still alive.
resolve
fn resolve(value: &Option<Self>) -> Option<Ref<T>>
The element referenced by a property value.
points_to
fn points_to<U: ObjectType>(self: &Self, element: &Ref<U>) -> bool
Whether the reference points at element.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafePropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedErasedDestructorIntoEitherClonePartialEqDebugFrom<&Ref<T>>
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.