Skip to main content

IconSetChoice

Enum IconSetChoice 

Source
#[non_exhaustive]
pub enum IconSetChoice { Default(String), System, Freedesktop(String), Material, Lucide, }
Expand description

The user’s icon set selection mode.

Represents the user’s intent for which icons to display. The key invariant: only Default is re-derived on theme changes. All other variants represent an explicit user choice that is preserved across theme re-applications.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Default(String)

Follow the theme preset’s recommendation.

The String is the preset’s icon_theme name (e.g. “Adwaita”), used for display (“default (Adwaita)”) and for loading when the icon set is Freedesktop.

This is the ONLY variant that gets overwritten on theme change. default_icon_choice() is the constructor that checks the theme is available (bundled sets are always available, SF Symbols and Segoe Fluent where their loader is compiled, freedesktop themes are checked via is_freedesktop_theme_available) before it returns this variant. A value built directly carries no such check.

§

System

Use the OS-configured icon theme.

Resolved at load time via system_icon_set(). The display label (“system (breeze-dark)”) is computed dynamically from system_icon_theme(), so it tracks runtime OS theme changes. Where detection fails the label is short, system (unavailable), as a control’s label is: system_icon_theme() gives the reason, for a tooltip or a note where there is room for it. The freedesktop loaders then search no theme for this choice.

§

Freedesktop(String)

User explicitly picked a specific installed freedesktop icon theme.

The String is the theme directory name (e.g. “char-white”, “breeze”, “Papirus”). Loaded via IconSet::Freedesktop with .theme(name).

§

Material

Google Material Symbols (bundled).

§

Lucide

Lucide Icons (bundled).

Implementations§

Source§

impl IconSetChoice

Source

pub fn effective_icon_set(&self, theme_icon_set: IconSet) -> IconSet

The effective IconSet loading mechanism for this choice.

For Default, returns the theme’s icon set (caller passes it in). For Freedesktop, always returns IconSet::Freedesktop. For others, returns the corresponding bundled or system set.

Source

pub fn freedesktop_theme(&self) -> Option<&str>

The freedesktop theme name to pass to FreedesktopLoader::theme, if any.

Returns Some(name) for Default and Freedesktop variants. Returns None for System, Material, Lucide.

The caller is responsible for only passing the result to FreedesktopLoader::theme when the effective icon set is IconSet::Freedesktop. For bundled sets (Material, Lucide), the theme name is not used by the loader.

Source

pub fn follows_preset(&self) -> bool

Whether this choice should be re-derived when the theme changes.

Only Default follows the preset. All others are explicit user choices that must be preserved.

Trait Implementations§

Source§

impl Clone for IconSetChoice

Source§

fn clone(&self) -> Self

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 IconSetChoice

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for IconSetChoice

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for IconSetChoice

Source§

impl PartialEq for IconSetChoice

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for IconSetChoice

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more