Skip to main content

Icons

Struct Icons 

Source
pub struct Icons { /* private fields */ }
Expand description

UI glyph cache, plus the Material file icons when that feature is on.

Implementations§

Source§

impl Icons

Source

pub fn new() -> Icons

An empty cache over the bundled glyphs.

Source

pub fn bundled() -> Vec<String>

The names of the bundled UI glyphs, sorted.

Source

pub fn register(&mut self, name: &str, svg: impl Into<Vec<u8>>)

Add or replace a glyph. Draw it in white so tinting works.

Source

pub fn lucide_names() -> Vec<String>

Available on crate feature lucide-icons only.

The names of the bundled Lucide icons, sorted.

Lucide names are resolved after the UI glyphs, so save keeps the workbench glyph and lucide-save forces Lucide. trash-2 (a name only Lucide has) also resolves. Both are drawn through the same white-tint pipeline.

Available on crate feature lucide-icons only.

Lucide icons matching query, best match first. Exact substring matches rank before subsequence matches; an empty query returns every name.

Source

pub fn texture(&mut self, ctx: &Context, name: &str) -> Option<TextureHandle>

The texture of a glyph, rasterized on first use.

Resolution order: registered custom SVG, bundled UI glyph, Lucide icon. Prefix a name with lucide- to skip the UI set when both have it.

Source

pub fn texture_sized( &mut self, ctx: &Context, name: &str, size: f32, ) -> Option<TextureHandle>

The texture of a glyph that stays crisp at size points on the current display.

Small glyphs share the 48 px texture; larger ones (gallery previews, empty states, toasts on HiDPI screens) are rasterized again at 96, 192, or 384 px.

Source

pub fn paint( &mut self, ui: &Ui, name: &str, center: Pos2, size: f32, color: Color32, ) -> bool

Paint a glyph centered in rect at size, tinted with color.

Source

pub fn put( &mut self, ui: &mut Ui, name: &str, center: Pos2, size: f32, color: Color32, ) -> bool

Place a glyph as a widget at center with ui.put, like the workbench’s title-bar and tab-strip buttons. Unlike Self::paint, this moves the layout cursor to the glyph’s edge, so the next button in the row starts there and overlaps the previous cell. That gives the workbench its compact button pitch (see metrics).

Source

pub fn show(&mut self, ui: &mut Ui, name: &str, size: f32)

Add a glyph at the cursor, tinted with the text color. Reserves the slot even when the glyph is missing, so rows never shift.

Source

pub fn show_tinted( &mut self, ui: &mut Ui, name: &str, size: f32, color: Color32, )

Add a glyph at the cursor with an explicit tint.

Trait Implementations§

Source§

impl Default for Icons

Source§

fn default() -> Icons

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Icons

§

impl !UnwindSafe for Icons

§

impl Forget for Icons

§

impl Freeze for Icons

§

impl Move for Icons

§

impl Send for Icons
where RawTable<(String, Vec<u8>)>: Send, RawTable<(String, TextureHandle)>: Send,

§

impl Sync for Icons
where RawTable<(String, Vec<u8>)>: Sync, RawTable<(String, TextureHandle)>: Sync,

§

impl Unpin for Icons

§

impl UnsafeUnpin for Icons

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,