FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    FerroPropertyDictionary

    struct · ferroui-base · v0.5.0

    struct FerroPropertyDictionary<TValue>
    

    Stores values with FerroProperty as key.

    This struct is very similar to a sorted list, with the following differences:

    • The key is the id of the property, allowing very fast lookups.
    • The entries are stored in one array, which is the only heap allocation.
    • It is a plain value: the owner mutates it in place.

    View source

    Members

    new

    fn new() -> Self
    

    Initializes a new instance.

    Source

    new_with_capacity

    fn new_with_capacity(capacity: usize) -> Self
    

    Initializes a new instance with the specified initial capacity.

    Source

    count

    fn count(self: &Self) -> usize
    

    Gets the number of items in the collection.

    Source

    get

    fn get(self: &Self, property: &FerroProperty) -> &TValue
    

    Gets the value associated with the specified property (the getter of the indexer by property).

    Panics when the property is not found.

    Source

    set

    fn set(self: &mut Self, property: &FerroProperty, value: TValue)
    

    Sets the value associated with the specified property (the setter of the indexer by property). An existing value is replaced.

    Source

    get_at

    fn get_at(self: &Self, index: usize) -> &TValue
    

    Gets the value at the specified index (the indexer by index).

    Panics when the index is not less than count.

    Source

    add

    fn add(self: &mut Self, property: &FerroProperty, value: TValue)
    

    Adds the specified property and value to the dictionary.

    Panics when the dictionary has the property already.

    Source

    clear

    fn clear(self: &mut Self)
    

    Removes all property and values from the dictionary.

    Source

    contains_key

    fn contains_key(self: &Self, property: &FerroProperty) -> bool
    

    Determines whether the dictionary contains the specified property.

    Source

    get_value

    fn get_value(self: &Self, index: usize) -> &TValue
    

    Gets the value at the specified index.

    Panics when the index is not less than count.

    Source

    remove

    fn remove(self: &mut Self, property: &FerroProperty) -> bool
    

    Removes the value with the specified property from the dictionary.

    Returns true if the property was found and removed; otherwise false.

    Source

    remove_value

    fn remove_value(self: &mut Self, property: &FerroProperty) -> Option<TValue>
    

    Removes the value with the specified property from the dictionary and returns it, or None when the property was not found.

    Source

    remove_at

    fn remove_at(self: &mut Self, index: usize)
    

    Removes the element at the specified index from the dictionary.

    Panics when the index is not less than count.

    Source

    try_add

    fn try_add(self: &mut Self, property: &FerroProperty, value: TValue) -> bool
    

    Attempts to add the specified property and value to the dictionary.

    Returns false when the dictionary has the property already.

    Source

    try_get_value

    fn try_get_value(self: &Self, property: &FerroProperty) -> Option<&TValue>
    

    Gets the value associated with the specified property, or None when the dictionary does not contain it.

    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.