Skip to main content

load_custom_icon

Function load_custom_icon 

Source
pub fn load_custom_icon(
    provider: &(impl IconProvider + ?Sized),
    set: IconSet,
) -> Option<IconData>
Expand description

Load an icon from any IconProvider, dispatching through the standard platform loading chain.

§Fallback chain

  1. Provider’s icon_name() – passed to platform system loader via load_system_icon_by_name()
  2. Provider’s icon_svg() – bundled SVG data
  3. Noneno cross-set fallback (mixing icon sets is forbidden)

§Examples

use native_theme::{load_custom_icon, IconRole, IconSet};

// IconRole implements IconProvider, so it works with load_custom_icon
let icon = load_custom_icon(&IconRole::ActionCopy, IconSet::Material);
assert!(icon.is_some());