pub struct Icon { /* private fields */ }Expand description
What to paint: a drawing, and the variant of it. Every component that takes an icon takes this, so a glyph and an app’s own file are one signature.
Implementations§
Source§impl Icon
impl Icon
Sourcepub const fn glyph(svg: &'static [u8]) -> Self
pub const fn glyph(svg: &'static [u8]) -> Self
A glyph from the set — Icon::glyph(glyph::Search). const, so a
component can hold one as a default and the linker still drops the rest.
Sourcepub fn asset(key: impl Into<SharedString>) -> Self
pub fn asset(key: impl Into<SharedString>) -> Self
Art of the app’s own, out of the AssetSource it registered. The set
cannot cover a product’s marks, and a library that took only its own
would be one an app cannot put its logo in.
Sourcepub fn file(path: impl Into<SharedString>) -> Self
pub fn file(path: impl Into<SharedString>) -> Self
A file on disk, for art that was not there at build time — one the user picked, one a fetch wrote down. gpui loads it off the paint thread and caches it, so the first frame or two paint nothing.
Sourcepub fn solid(self) -> Self
pub fn solid(self) -> Self
Filled rather than outlined — SwiftUI’s .symbolVariant(.fill). Lucide
draws one weight, so this fills the outline rather than reaching for a
second drawing: filling and stroking keeps the outer edge exactly
where the outline puts it, so a control swapping between them —
favourited or not — does not jump.
Trait Implementations§
impl Eq for Icon
impl StructuralPartialEq for Icon
Auto Trait Implementations§
impl Freeze for Icon
impl RefUnwindSafe for Icon
impl Send for Icon
impl Sync for Icon
impl Unpin for Icon
impl UnsafeUnpin for Icon
impl UnwindSafe for Icon
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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