[−][src]Struct icon_loader::Icon
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 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); }
pub fn file_for_size_scaled(&self, size: u16, scale: u16) -> &IconFile
[src]
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); }
pub fn file_for_size_filtered(
&self,
size: u16,
filter: impl Fn(&IconFile) -> bool
) -> Option<&IconFile>
[src]
&self,
size: u16,
filter: impl Fn(&IconFile) -> bool
) -> Option<&IconFile>
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 anIconFile
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
impl Clone for Icon
[src]
impl Debug for Icon
[src]
impl Eq for Icon
[src]
impl Hash for Icon
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CallHasher for T where
T: Hash,
T: Hash,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,