pub struct IconSet { /* private fields */ }Expand description
A collection of named icon definitions.
IconSet stores icon definitions and resolves them for a given
IconMode into a flat map of name → string.
§Example
use standout_render::{IconSet, IconDefinition, IconMode};
let icons = IconSet::new()
.add("check", IconDefinition::new("[ok]").with_nerdfont("\u{f00c}"))
.add("cross", IconDefinition::new("[!!]").with_nerdfont("\u{f00d}"));
let resolved = icons.resolve(IconMode::Classic);
assert_eq!(resolved.get("check").unwrap(), "[ok]");
assert_eq!(resolved.get("cross").unwrap(), "[!!]");Implementations§
Source§impl IconSet
impl IconSet
Sourcepub fn add(self, name: impl Into<String>, def: IconDefinition) -> Self
pub fn add(self, name: impl Into<String>, def: IconDefinition) -> Self
Adds an icon definition, returning self for chaining.
Sourcepub fn insert(&mut self, name: impl Into<String>, def: IconDefinition)
pub fn insert(&mut self, name: impl Into<String>, def: IconDefinition)
Inserts an icon definition by mutable reference.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IconSet
impl RefUnwindSafe for IconSet
impl Send for IconSet
impl Sync for IconSet
impl Unpin for IconSet
impl UnsafeUnpin for IconSet
impl UnwindSafe for IconSet
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
Mutably borrows from an owned value. Read more