pub struct Icon { /* private fields */ }
Expand description

Struct containing information about a themed icon.

Implementations

Returns the associated icon’s name.

Returns the associated icon’s theme name.

Returns the icon files found for the associated icon.

Returns the file of the associated icon that fits the given size best and has a scale of 1. If there is no exact fit available, the next bigger one is chosen. If there is no bigger one, the next smaller one is returned. If that cannot be found, the scale restriction is ignored.

Arguments
  • size - The ideal size of the returned icon file.
Example
use icon_loader::IconLoader;

let loader = IconLoader::new();
if let Ok(icon) = loader.load_icon("minimum") {
    let icon_file = icon.file_for_size(32);
}

Returns the file of the associated icon that fits the given size and scale best. If there is no exact fit available, the next bigger size is chosen. If there is no bigger fit with the given scale, the next smaller one is returned. If no file with the preferred scale can be found, one with the size size * scale and scale 1 is looked for. If that cannot be found, the scale restriction is ignored.

Arguments
  • size - The ideal size of the returned icon file.
  • scale - The preferred scale of the returned icon file.
Example
use icon_loader::IconLoader;

let loader = IconLoader::new();
if let Ok(icon) = loader.load_icon("minimum") {
    let icon_file = icon.file_for_size_scaled(32, 2);
}

Returns the file of the associated icon that fits the given size best and matches the provided filter. If there is no exact fit available, the next bigger one is chosen. If there is no bigger one, the next smaller one is returned. Use this, if you want only files of type PNG or anything like that.

Arguments
  • size - The ideal size of the returned icon file.
  • filter - A function that takes a reference to an IconFile and returns true, if it passes the test and false otherwise.
Example
use icon_loader::{IconLoader, IconFileType};

let loader = IconLoader::new();
if let Ok(icon) = loader.load_icon("minimum") {
    let icon_file = icon.file_for_size_filtered(32, |file| file.icon_type() == IconFileType::PNG);
}

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.