pub fn load_custom_icon(
provider: &(impl IconProvider + ?Sized),
icon_set: &str,
) -> Option<IconData>Expand description
Load an icon from any IconProvider, dispatching through the standard
platform loading chain.
§Fallback chain
- Provider’s
icon_name()– passed to platform system loader viaload_system_icon_by_name() - Provider’s
icon_svg()– bundled SVG data None– no cross-set fallback (mixing icon sets is forbidden)
The icon_set string is parsed via IconSet::from_name(), falling back
to system_icon_set() for unrecognized names.
§Examples
use native_theme::{load_custom_icon, IconRole};
// IconRole implements IconProvider, so it works with load_custom_icon
let icon = load_custom_icon(&IconRole::ActionCopy, "material");
assert!(icon.is_some());