Skip to main content

IconSetRegistry

Struct IconSetRegistry 

Source
pub struct IconSetRegistry { /* private fields */ }
Expand description

All icon sets known to an application: the built-in ones plus the application’s own.

A set is drawn when a theme names it ([meta] icon-set). Keys of the application’s sets that the built-in set does not have, such as category.internet, are drawn whatever set is chosen: they sit under the chosen set, so a theme’s set or single icon can still restyle them, and a set added later wins a key two application sets give. A key the built-in set already has, such as check, is a restyling of the framework’s own icon, which every widget draws; it applies only while its set is the chosen one, so an application set never changes the icons of a set the user picked.

Implementations§

Source§

impl IconSetRegistry

Source

pub fn builtin() -> Self

A registry holding the built-in icon sets.

Source

pub fn add_source(&mut self, id: &str, file: &str, text: &str) -> bool

Adds or replaces the icon set id from TOML text. Returns whether it was usable.

Its keys the built-in set lacks are drawn in every set from then on; see IconSetRegistry for how it layers with the chosen set.

Source

pub fn load_dir(&mut self, dir: &Path) -> Result<()>

Loads every *.toml file in dir; the file stem is the set id.

§Errors

Returns the I/O error when the directory cannot be read. A file that cannot be read is skipped and reported in the diagnostics.

Source

pub fn list(&self) -> Vec<(String, String)>

(id, display name) of every set, sorted by id.

Source

pub fn diagnostics(&self) -> &[Diagnostic]

Problems found while loading.

Source

pub fn icons( &self, id: &str, overrides: &BTreeMap<String, IconGlyphs>, mode: GlyphMode, ) -> Icons

Builds the icons for set id with overrides applied on top.

An unknown id falls back to the built-in default set.

Source

pub fn icons_with_animations( &self, id: &str, overrides: &BTreeMap<String, IconGlyphs>, animations: &BTreeMap<String, Arc<CellAnimation>>, mode: GlyphMode, ) -> Icons

Builds the icons and animations for set id, with icon overrides and animations (such as a theme’s) applied on top.

Animations layer from the built-in default set, through set id, to the overrides, so a set or theme without animations still has every built-in one. Within a layer, a former spinner icon key such as spinner-arc first replaces the glyphs of its animation, then the layer’s own animations apply. An unknown id falls back to the built-in default set.

Trait Implementations§

Source§

impl Clone for IconSetRegistry

Source§

fn clone(&self) -> IconSetRegistry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IconSetRegistry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.