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.
Members
DEFAULT_ARRAY_SIZE
const DEFAULT_ARRAY_SIZE: usize
new
fn new() -> Self
is_empty
fn is_empty(self: &Self) -> bool
need_compact
fn need_compact(self: &Self) -> bool
add
fn add(self: &mut Self, item: &Rc<T>)
remove
fn remove(self: &mut Self, item: &Rc<T>)
compact
fn compact(self: &mut Self)
return_to_shared_pool
fn return_to_shared_pool(list: Vec<Rc<T>>)
Clears list and keeps it for a later get_alive.
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.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEitherDefault
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.