FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    ResourceDictionary

    struct · ferroui-base · v0.5.0

    struct ResourceDictionary
    

    An indexed dictionary of resources.

    View source

    Members

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this class.

    Source

    to_ref

    fn to_ref(self: &Self) -> $crate::Ref<ResourceDictionary>
    

    Returns a strong reference to this object.

    Source

    construct

    fn construct() -> Self
    

    Creates the class data; see FerroObject::construct.

    Source

    construct_with_owner

    fn construct_with_owner(owner: &ResourceHostRef) -> Self
    

    Creates the class data of a dictionary that belongs to owner.

    Source

    new

    fn new() -> Ref<Self>
    

    Creates an empty resource dictionary.

    Source

    with_owner

    fn with_owner(owner: impl Into<ResourceHostRef>) -> Ref<Self>
    

    Creates an empty resource dictionary that belongs to owner.

    Source

    count

    fn count(self: &Self) -> usize
    

    The number of resources in the dictionary itself.

    Source

    get

    fn get(self: &Self, key: &ResourceKey) -> ResourceValue
    

    Gets a resource of the dictionary itself; None (a null value) if the key is not present.

    Source

    set

    fn set(self: &Self, key: impl Into<ResourceKey>, value: ResourceValue)
    

    Adds or replaces a resource.

    Source

    keys

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

    The keys of the resources in the dictionary itself.

    Source

    merged_dictionaries

    fn merged_dictionaries(self: &Self) -> FerroList<Rc<dyn IResourceProvider>>
    

    The child resource dictionaries.

    The list is returned by handle: clones refer to the same list.

    Source

    add_merged_dictionary

    fn add_merged_dictionary(self: &Self, provider: impl Into<Rc<dyn IResourceProvider>>)
    

    Adds a child resource dictionary.

    Source

    remove_merged_dictionary

    fn remove_merged_dictionary(self: &Self, provider: &Rc<dyn IResourceProvider>) -> bool
    

    Removes a child resource dictionary. Returns whether it was present.

    Source

    theme_dictionaries

    fn theme_dictionaries(self: &Self) -> FerroDictionary<ThemeVariant, Rc<dyn IThemeVariantProvider>>
    

    The resource providers used for specific theme variants.

    The dictionary is returned by handle: clones refer to the same dictionary. A provider added to it gets the owner of this dictionary; a removed one loses it.

    Source

    theme_dictionaries_snapshot

    fn theme_dictionaries_snapshot(self: &Self) -> Vec<(ThemeVariant, Rc<dyn IThemeVariantProvider>)>
    

    A snapshot of the resource providers used for specific theme variants.

    Source

    theme_dictionary

    fn theme_dictionary(self: &Self, variant: &ThemeVariant) -> Option<Rc<dyn IThemeVariantProvider>>
    

    The resource provider used for the given theme variant.

    Source

    add_theme_dictionary

    fn add_theme_dictionary(self: &Self, variant: ThemeVariant, provider: impl Into<Rc<dyn IThemeVariantProvider>>)
    

    Adds a resource provider for a theme variant. Panics if the variant already has one.

    Source

    set_theme_dictionary

    fn set_theme_dictionary(self: &Self, variant: ThemeVariant, provider: impl Into<Rc<dyn IThemeVariantProvider>>)
    

    Adds or replaces the resource provider of a theme variant.

    Source

    remove_theme_dictionary

    fn remove_theme_dictionary(self: &Self, variant: &ThemeVariant) -> bool
    

    Removes the resource provider of a theme variant. Returns whether it was present.

    Source

    key

    fn key(self: &Self) -> Option<ThemeVariant>
    

    The key that is used in the theme dictionaries of the containing resource dictionary.

    Source

    set_key

    fn set_key(self: &Self, value: Option<ThemeVariant>)
    

    Source

    add

    fn add(self: &Self, key: impl Into<ResourceKey>, value: ResourceValue)
    

    Adds a resource. Panics if the key is already present.

    Source

    add_value

    fn add_value<T: PartialEq + 'static>(self: &Self, key: impl Into<ResourceKey>, value: T)
    

    Adds a resource value. Panics if the key is already present.

    Source

    add_deferred_fn

    fn add_deferred_fn(self: &Self, key: impl Into<ResourceKey>, factory: impl Fn(Option<&Rc<dyn IServiceProvider>>) -> Option<BoxedValue> + 'static)
    

    Adds a resource that is created by factory the first time it is requested.

    Source

    add_deferred

    fn add_deferred(self: &Self, key: impl Into<ResourceKey>, deferred_content: Rc<dyn IDeferredContent>)
    

    Adds a resource that is built from deferred_content the first time it is requested.

    Source

    add_not_shared_deferred

    fn add_not_shared_deferred(self: &Self, key: impl Into<ResourceKey>, deferred_content: Rc<dyn IDeferredContent>)
    

    Adds a resource that is built from deferred_content every time it is requested.

    Source

    set_items

    fn set_items(self: &Self, values: impl IntoIterator<Item = (ResourceKey, ResourceValue)>)
    

    Adds or replaces multiple resources, raising a single notification.

    Source

    clear

    fn clear(self: &Self)
    

    Removes all resources of the dictionary itself.

    Source

    contains_key

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

    Whether the dictionary itself contains the key.

    Source

    remove

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

    Removes a resource. Returns whether it was present.

    Source

    try_get_value

    fn try_get_value(self: &Self, key: &ResourceKey) -> Option<ResourceValue>
    

    Gets a resource of the dictionary itself, building it if it is deferred.

    Source

    ensure_capacity

    fn ensure_capacity(self: &Self, capacity: usize)
    

    Ensures that the dictionary can hold up to capacity resources without further expansion of its backing storage.

    Source

    contains_deferred_key

    fn contains_deferred_key(self: &Self, key: &ResourceKey) -> bool
    

    Whether the key is present and its resource has not been built yet.

    Source

    Trait implementations

    Availability

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