[][src]Struct icon_loader::Icon

pub struct Icon { /* fields omitted */ }

Struct containing information about a themed icon.

Implementations

impl Icon[src]

pub fn icon_name(&self) -> &str[src]

Returns the associated icon's name.

pub fn theme_name(&self) -> &str[src]

Returns the associated icon's theme name.

pub fn files(&self) -> &[IconFile][src]

Returns the icon files found for the associated icon.

pub fn file_for_size(&self, size: u16) -> &IconFile[src]

Returns the file of the associated icon that fits the given size best. If there is no exact fit available, the next bigger one is chosen. If there is no bigger one, the next smaller is returned.

Arguments

  • size - The ideal size of the returned icon file.

Example

use icon_loader::{IconLoader, IconType};

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

pub fn file_for_size_filtered<F>(
    &self,
    size: u16,
    filter: F
) -> Option<&IconFile> where
    F: Fn(&IconFile) -> bool
[src]

Returns the file of the associated icon that fits the given size best and matches the provided filter. 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, IconType};

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() == IconType::PNG);
}

See also file_for_size.

Trait Implementations

impl Clone for Icon[src]

impl Debug for Icon[src]

impl Eq for Icon[src]

impl Hash for Icon[src]

impl PartialEq<Icon> for Icon[src]

impl StructuralEq for Icon[src]

impl StructuralPartialEq for Icon[src]

Auto Trait Implementations

impl RefUnwindSafe for Icon

impl Send for Icon

impl Sync for Icon

impl Unpin for Icon

impl UnwindSafe for Icon

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,