IcedExt

Trait IcedExt 

Source
pub trait IcedExt {
    // Required methods
    fn iced_font() -> Font;
    fn into_text<'a, Theme>(
        self,
        font_size: impl Into<Pixels>,
    ) -> Text<'a, Theme>
       where Theme: Catalog;
}
Available on crate feature iced only.
Expand description

Extension trait for using these icons from within iced

  • NerdFont::FONT_BYTES is the raw bytes of the font, for loading into iced
  • NerdFont also implements Into<iced::Element>, which will use the default font size
use nerd_font::{IcedExt, categories::Dev};

// A text widget configured to use the icon font, with the selected glyph, and a font size of 24
let text_widget = Dev::Android.into_text(24);

You will additionally need to load the font, by calling .font(NerdFont::FONT_BYTES) on your iced::Application.

Required Methods§

Source

fn iced_font() -> Font

Returns a font definition for this font
Used for the font method on iced text widgets

Source

fn into_text<'a, Theme>(self, font_size: impl Into<Pixels>) -> Text<'a, Theme>
where Theme: Catalog,

Converts this enum into an iced Text widget
Sets the font-size of the new widget

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<S: Into<NerdFont>> IcedExt for S