FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    WeakHashList

    struct · ferroui-base · v0.5.0

    struct WeakHashList<T: ?Sized + 'static>
    

    A list of weakly referenced items, compared by identity.

    Up to DEFAULT_ARRAY_SIZE items are kept in an array; beyond that the list switches to a dictionary that counts how many times each item was added.

    View source

    Members

    DEFAULT_ARRAY_SIZE

    const DEFAULT_ARRAY_SIZE: usize
    

    Source

    new

    fn new() -> Self
    

    Source

    is_empty

    fn is_empty(self: &Self) -> bool
    

    Source

    need_compact

    fn need_compact(self: &Self) -> bool
    

    Source

    add

    fn add(self: &mut Self, item: &Rc<T>)
    

    Source

    remove

    fn remove(self: &mut Self, item: &Rc<T>)
    

    Source

    compact

    fn compact(self: &mut Self)
    

    Source

    return_to_shared_pool

    fn return_to_shared_pool(list: Vec<Rc<T>>)
    

    Clears list and keeps it for a later get_alive.

    Source

    get_alive

    fn get_alive(self: &mut Self, factory: Option<&dyn Fn() -> Vec<Rc<T>>>) -> Option<Vec<Rc<T>>>
    

    The items that are still alive, or None if there are none. The list comes from factory when given, else from the shared pool.

    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
    • Default

    Availability

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