FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    InlineDictionary

    struct · ferroui-base · v0.5.0

    struct InlineDictionary<TKey, TValue>
    

    A dictionary that holds one entry in place, up to six entries in a small array and more in a hash map.

    The original restricts keys to reference types and compares them by reference while the dictionary holds its entries in place or in the array; here keys compare with == in every state, which is identity for the handle types of this crate.

    View source

    Members

    new

    fn new() -> Self
    

    Source

    add

    fn add(self: &mut Self, key: TKey, value: TValue)
    

    Adds an entry.

    Panics when the small array or the dictionary has the key already. As in the original, a dictionary that holds one entry in place does not test for it.

    Source

    set

    fn set(self: &mut Self, key: TKey, value: TValue)
    

    Adds an entry or replaces its value.

    Source

    get

    fn get(self: &Self, key: &TKey) -> &TValue
    

    The value of a key (the getter of the indexer).

    Panics when the dictionary does not have the key.

    Source

    remove

    fn remove(self: &mut Self, key: &TKey) -> bool
    

    Source

    clear

    fn clear(self: &mut Self)
    

    Removes every entry.

    As in the original, the value of an entry that is held in place is kept and becomes the value of the next key that get_value_ref_or_add_default adds in place.

    Source

    has_entries

    fn has_entries(self: &Self) -> bool
    

    Source

    try_get_value

    fn try_get_value(self: &Self, key: &TKey) -> Option<&TValue>
    

    Source

    get_value_ref_or_null_ref

    fn get_value_ref_or_null_ref(self: &mut Self, key: &TKey) -> Option<&mut TValue>
    

    A reference to the value of a key, or None (the original's null reference) when the dictionary does not have the key.

    Source

    get_value_ref_or_add_default

    fn get_value_ref_or_add_default(self: &mut Self, key: TKey) -> (&mut TValue, bool)
    

    A reference to the value of a key, which is added with the default value when the dictionary does not have it, and whether it existed.

    Source

    try_get_and_remove_value

    fn try_get_and_remove_value(self: &mut Self, key: &TKey) -> Option<TValue>
    

    Removes an entry and returns its value.

    As in the original, an entry of a dictionary that has grown into a hash map is removed without its value being returned.

    Source

    get_and_remove

    fn get_and_remove(self: &mut Self, key: &TKey) -> TValue
    

    Removes an entry and returns its value.

    Panics when try_get_and_remove_value returns nothing.

    Source

    get_enumerator

    fn get_enumerator(self: &Self) -> InlineDictionaryEnumerator<'_, TKey, TValue>
    

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

    Availability

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