FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    new

    fn new<U: ObjectType + Upcast<T>>(element: &Ref<U>) -> Self
    

    Creates a reference to element.

    Source

    of

    fn of(element: &Ref<T>) -> Self
    

    Creates a reference to an element of exactly class T.

    Source

    from_nullable

    fn from_nullable(element: Option<Ref<T>>) -> Option<Self>
    

    The property value for an optional element.

    Source

    get

    fn get(self: &Self) -> Option<Ref<T>>
    

    The referenced element, if it is still alive.

    Source

    resolve

    fn resolve(value: &Option<Self>) -> Option<Ref<T>>
    

    The element referenced by a property value.

    Source

    points_to

    fn points_to<U: ObjectType>(self: &Self, element: &Ref<U>) -> bool
    

    Whether the reference points at element.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ErasedDestructor
    • IntoEither
    • Clone
    • PartialEq
    • Debug
    • From<&Ref<T>>

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.