pub struct FileIcon {
pub icon: char,
pub color: &'static str,
}
Expand description
The FileIcon
struct contains the icon and color of a file type.
This struct is probably the only one you should interact with directly
and is the preferred way to get the icon for a file.
The icon
field is a unicode character that corresponds to the correct
icon for the file type (which can be printed to the terminal with fonts
that support it, e.g. typically NerdFonts
).
The color
field is a hex color code that corresponds to the color of the
icon. This can be used to color the icon in the terminal using your own method
(e.g. ANSI escape codes, existing crates like termcolor
etc.).
§Example
use devicons::{FileIcon};
let icon = FileIcon::from("Cargo.toml");
println!("Icon: {} {}", icon.icon, icon.color);
Fields§
§icon: char
§color: &'static str
Trait Implementations§
impl Copy for FileIcon
impl Eq for FileIcon
impl StructuralPartialEq for FileIcon
Auto Trait Implementations§
impl Freeze for FileIcon
impl RefUnwindSafe for FileIcon
impl Send for FileIcon
impl Sync for FileIcon
impl Unpin for FileIcon
impl UnwindSafe for FileIcon
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more