Function file_icon_for_name

Source
pub fn file_icon_for_name(name: &str) -> IconId
Expand description

Chooses a Devicons glyph for a filename, with a generic-file fallback.

Matching follows the upstream Devicons mapping and is based on the supplied name only; no filesystem access occurs. The recommended tint is discarded.

ยงExamples

use ailloli_ui_core::IconId;
use ailloli_ui_widgets::files::file_icon_for_name;
assert!(matches!(file_icon_for_name("main.rs"), IconId::Devicon(_)));
assert!(matches!(file_icon_for_name("unknown"), IconId::Devicon(_)));