chore(icon_theme): store default theme as Cow<str>
This commit is contained in:
parent
2ab760e66d
commit
5904d2c0f0
1 changed files with 5 additions and 4 deletions
|
|
@ -3,20 +3,21 @@
|
|||
|
||||
//! Select the preferred icon theme.
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::cell::RefCell;
|
||||
|
||||
thread_local! {
|
||||
/// The fallback icon theme to search if no icon theme was specified.
|
||||
pub(crate) static DEFAULT: RefCell<String> = RefCell::new(String::from("Cosmic"));
|
||||
pub(crate) static DEFAULT: RefCell<Cow<'static, str>> = RefCell::new("Cosmic".into());
|
||||
}
|
||||
|
||||
/// The fallback icon theme to search if no icon theme was specified.
|
||||
#[must_use]
|
||||
pub fn default() -> String {
|
||||
DEFAULT.with(|f| f.borrow().clone())
|
||||
DEFAULT.with(|theme| theme.borrow().to_string())
|
||||
}
|
||||
|
||||
/// Set the fallback icon theme to search when loading system icons.
|
||||
pub fn set_default(name: impl Into<String>) {
|
||||
DEFAULT.with(|f| *f.borrow_mut() = name.into());
|
||||
pub fn set_default(name: impl Into<Cow<'static, str>>) {
|
||||
DEFAULT.with(|theme| *theme.borrow_mut() = name.into());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue