ValueSingleOrList
struct · ferroui-base · v0.5.0
struct ValueSingleOrList<T>
A list like struct optimized for holding zero or one items.
Once more than one value has been added to this storage it will switch to
using a Vec internally.
Members
single
fn single(self: &Self) -> Option<&T>
Single contained value. Only valid if is_single is set.
list
fn list(self: &Self) -> Option<&Vec<T>>
List of values.
has_list
fn has_list(self: &Self) -> bool
If this struct is backed by a list.
is_single
fn is_single(self: &Self) -> bool
If this struct contains only single value and storage was not promoted to a list.
add
fn add(self: &mut Self, value: T)
Adds a value.
remove
fn remove(self: &mut Self, value: &T) -> bool
Removes a value.
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.