pub struct Cache { /* private fields */ }Expand description
Icon cache, before lookups one may need to load required theme(s) explicitly either with Cache::load or Cache::load_default.
Implementations§
Source§impl Cache
impl Cache
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Creates new cache. Most of the lookups are to be failed at this point. Consider loading icons afterwards.
Sourcepub fn load_default(&mut self) -> Result<()>
pub fn load_default(&mut self) -> Result<()>
Load icons for default (HiColor) icon theme.
Sourcepub fn load(&mut self, theme: impl Into<String>) -> Result<()>
pub fn load(&mut self, theme: impl Into<String>) -> Result<()>
Load icons for specified icon theme.
Sourcepub fn lookup_advanced<'a, F>(
&'a self,
name: &str,
theme: impl Into<Option<&'a str>>,
f: F,
) -> Option<PathBuf>
pub fn lookup_advanced<'a, F>( &'a self, name: &str, theme: impl Into<Option<&'a str>>, f: F, ) -> Option<PathBuf>
Advanced icon lookup provides general solution over Cache::lookup.
Similarly it requires an icon name and optional theme to look for.
Also a provided closure is called for a list of discovered IconInfo’s.
Notice that icons list might be incomplete (e.g doesn’t include inherited themes).
Sourcepub fn lookup<'a>(
&'a self,
name: &str,
theme: impl Into<Option<&'a str>>,
) -> Option<PathBuf>
pub fn lookup<'a>( &'a self, name: &str, theme: impl Into<Option<&'a str>>, ) -> Option<PathBuf>
Icon lookup for a specified name and optional theme to look for.
If theme is unspecified the default one is used.
Sourcepub fn lookup_param<'a>(&'a self, param: LookupParam<'a>) -> Option<PathBuf>
pub fn lookup_param<'a>(&'a self, param: LookupParam<'a>) -> Option<PathBuf>
Icon lookup with a provided LookupParam. It works as described in Freedesktop icon lookup spec.
Auto Trait Implementations§
impl Freeze for Cache
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnwindSafe for Cache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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