Expand description
Unified icon packs for Rust GUI apps (egui, iced, and similar).
Enable the pack features you need (for example pack-bootstrap), register
fonts from fonts, then resolve glyphs with try_icon (or resolve_all
for full-pack picker grids).
§Feature gating and Pack
With no pack-* features, Pack is an empty enum: there are no variants to
construct, so list / try_icon are not callable and fail at compile time.
That empty-feature case does not surface as IconError::PackDisabled.
When other packs are enabled, a pack you did not enable simply has no Pack::…
variant (compile error if named). IconError::PackDisabled is retained for a
stable error surface; the only in-tree constructor is the zero-feature stub
(pack: "none"), unreachable via a constructible Pack.
§Examples
Default features (no packs enabled) still exercise the public types:
use iconflow::{IconError, Size, Style};
assert_eq!(Size::default(), Size::Regular);
assert_eq!(Style::default(), Style::Regular);
assert_eq!(Size::Custom(24).to_string(), "custom(24)");
assert_eq!(Style::Filled.to_string(), "filled");
let err = IconError::PackDisabled { pack: "bootstrap" };
assert_eq!(err.to_string(), "pack `bootstrap` is disabled");With a pack feature, resolve a glyph by name:
use iconflow::{try_icon, Pack, Size, Style};
let icon = try_icon(Pack::Bootstrap, "alarm", Style::Regular, Size::Regular)?;
assert_eq!(icon.family, "Bootstrap Regular");§Known limitations
Dual static name storage (ICON_NAMES plus each entry’s name) is intentional so
list can return &'static [&str] while the entry table keeps per-icon metadata.
Structs§
- Font
Asset - Font bytes and family name for a specific variant.
- IconRef
- Reference to a concrete glyph inside a font.
Enums§
- Icon
Error - Errors returned by
crate::try_iconand related lookup helpers. - Pack
- Icon pack selectable via
crate::try_icon/crate::list/crate::resolve_all. - Size
- Canonical size variants for icon packs.
- Style
- Canonical style variants for icon packs.
Functions§
- fonts
- Returns every embedded
FontAssetfrom enabled packs. - list
- Returns the sorted list of icon names available in
pack. - resolve_
all - Resolves every icon in
packfor(style, size)in table order. - try_
icon - Resolves an icon in
packby stringname,style, andsize.