FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    single

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

    Single contained value. Only valid if is_single is set.

    Source

    list

    fn list(self: &Self) -> Option<&Vec<T>>
    

    List of values.

    Source

    has_list

    fn has_list(self: &Self) -> bool
    

    If this struct is backed by a list.

    Source

    is_single

    fn is_single(self: &Self) -> bool
    

    If this struct contains only single value and storage was not promoted to a list.

    Source

    add

    fn add(self: &mut Self, value: T)
    

    Adds a value.

    Source

    remove

    fn remove(self: &mut Self, value: &T) -> bool
    

    Removes a value.

    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.