FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    RefCounted

    struct · ferroui-base · v0.5.0

    struct RefCounted<T: ?Sized + 'static>
    

    An explicitly counted reference to a shared resource.

    Every reference is disposed on its own; the resource is released when the last one is disposed. A reference that is dropped without having been disposed releases its count as well.

    References are shared between the UI thread and the render thread: the count is atomic, as in the original.

    View source

    Members

    dispose

    fn dispose(self: &Self)
    

    Releases this reference.

    Source

    item

    fn item(self: &Self) -> Arc<T>
    

    The referenced resource. Panics if this reference has been disposed.

    Source

    clone_ref

    fn clone_ref(self: &Self) -> RefCounted<T>
    

    Creates another reference to the resource. Panics if this reference has been disposed.

    Source

    clone_as

    fn clone_as<TResult: ?Sized + 'static>(self: &Self, cast: impl FnOnce(Arc<T>) -> Arc<TResult>) -> RefCounted<TResult>
    

    Creates another reference to the resource, viewed as another type. Panics if this reference has been disposed.

    Source

    is_alive

    fn is_alive(self: &Self) -> bool
    

    Whether this reference has not been disposed.

    Source

    ref_count

    fn ref_count(self: &Self) -> i32
    

    The number of live references to the resource. Panics if this reference has been disposed.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ErasedDestructor
    • IntoEither
    • Drop

    Availability

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