pub fn load_icon(role: IconRole, set: IconSet) -> Option<IconData>Expand description
Load an icon for the given role using the specified icon set.
Dispatches to the appropriate platform loader or bundled icon set
based on the IconSet variant:
IconSet::Freedesktop– freedesktop theme lookup at 24 px using the system’s installed icon theme (requiressystem-iconsfeature, Linux only)IconSet::SfSymbols– SF Symbols lookup (requiressystem-iconsfeature, macOS only)IconSet::SegoeIcons– Segoe Fluent lookup (requiressystem-iconsfeature, Windows only)IconSet::Material– bundled Material SVG (requiresmaterial-iconsfeature)IconSet::Lucide– bundled Lucide SVG (requireslucide-iconsfeature)
Returns None when the required feature is not enabled, the platform
doesn’t match, or the role has no icon in the requested set.
There is no cross-set fallback – each set is self-contained.
§Examples
use native_theme::{load_icon, IconRole, IconSet};
// With material-icons feature enabled
let icon = load_icon(IconRole::ActionCopy, IconSet::Material);
assert!(icon.is_some());