FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    FerroDictionary

    struct · ferroui-base · v0.5.0

    struct FerroDictionary<K, V>
    

    A notifying dictionary.

    Changes raise the collection changed event and property changed notifications for Count and Item[key] (Item when the dictionary is cleared). Keys are shown in those names through their Display form.

    Enumeration works on a copy, so the dictionary may be modified from within an enumeration or a change notification.

    The dictionary is a reference object: the value is a shared handle, clones refer to the same dictionary and handles compare by identity.

    View source

    Members

    ptr_eq

    fn ptr_eq(self: &Self, other: &Self) -> bool
    

    Whether two handles refer to the same dictionary.

    Source

    new

    fn new() -> Self
    

    Creates an empty dictionary.

    Source

    with_capacity

    fn with_capacity(capacity: usize) -> Self
    

    Creates an empty dictionary with room for capacity entries.

    Source

    from_dictionary

    fn from_dictionary(dictionary: impl IntoIterator<Item = (K, V)>) -> Self
    

    Creates a dictionary with the entries of dictionary. A key that occurs more than once keeps its last value.

    Source

    add_collection_changed

    fn add_collection_changed(self: &Self, handler: Rc<CollectionChangedHandler<(K, V)>>) -> u64
    

    Subscribes to changes of the collection. Returns a token for remove_collection_changed.

    Source

    remove_collection_changed

    fn remove_collection_changed(self: &Self, token: u64) -> bool
    

    Unsubscribes a handler.

    Source

    has_collection_changed_subscribers

    fn has_collection_changed_subscribers(self: &Self) -> bool
    

    Whether anything is subscribed to changes of the collection, typed or untyped.

    Source

    count

    fn count(self: &Self) -> usize
    

    The number of entries.

    Source

    is_empty

    fn is_empty(self: &Self) -> bool
    

    Source

    is_read_only

    fn is_read_only(self: &Self) -> bool
    

    Source

    keys

    fn keys(self: &Self) -> Vec<K>
    

    The keys, in enumeration order.

    Source

    values

    fn values(self: &Self) -> Vec<V>
    

    The values, in enumeration order.

    Source

    get

    fn get(self: &Self, key: &K) -> V
    

    The value for key. Panics if the key is not present.

    Source

    try_get_value

    fn try_get_value(self: &Self, key: &K) -> Option<V>
    

    The value for key, if present.

    Source

    set

    fn set(self: &Self, key: K, value: V)
    

    Sets the value for key, adding the entry if it is not present.

    Source

    add

    fn add(self: &Self, key: K, value: V)
    

    Adds an entry. Panics if the key is already present.

    Source

    clear

    fn clear(self: &Self)
    

    Removes all entries.

    Source

    contains_key

    fn contains_key(self: &Self, key: &K) -> bool
    

    Source

    contains

    fn contains(self: &Self, key: &K, value: &V) -> bool
    where V: PartialEq
    

    Whether the dictionary has the entry key with a value equal to value.

    Source

    to_vec

    fn to_vec(self: &Self) -> Vec<(K, V)>
    

    The entries, in enumeration order.

    Source

    copy_to

    fn copy_to(self: &Self, array: &mut [(K, V)], array_index: usize)
    

    Copies the entries, in enumeration order, to array, starting at array_index (CopyTo).

    Panics

    Panics if array is too small, as the managed original throws.

    Source

    for_each

    fn for_each(self: &Self, f: impl FnMut(&K, &V) -> ())
    

    Calls f for each entry of a copy of the dictionary.

    Source

    remove

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

    Removes the entry for key. Returns false if it is not present.

    Source

    Trait implementations

    Availability

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