WindowIcon

Enum WindowIcon 

Source
#[non_exhaustive]
pub enum WindowIcon { Default, Image(ImageSource), }
Expand description

Window icon.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Default

The operating system’s default icon.

§

Image(ImageSource)

Image is requested from IMAGES.

Implementations§

Source§

impl WindowIcon

Source

pub fn render(new_icon: impl Fn() -> UiNode + Send + Sync + 'static) -> Self

New window icon from a closure that generates a new icon UiNode for the window.

The closure is called once on init and every time the window icon property changes, the closure runs in a headless window context, it must return a node to be rendered as an icon.

The icon node is deinited and dropped after the first render, you can enable image::render_retain on it to cause the icon to continue rendering on updates.

§Examples
WindowIcon::render(|| {
    Container! {
        // image::render_retain = true;
        size = (36, 36);
        background_gradient = Line::to_bottom_right(), stops![colors::MIDNIGHT_BLUE, 70.pct(), colors::CRIMSON];
        corner_radius = 6;
        font_size = 28;
        font_weight = FontWeight::BOLD;
        child = Text!("A");
    }
})

Trait Implementations§

Source§

impl Clone for WindowIcon

Source§

fn clone(&self) -> WindowIcon

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WindowIcon

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WindowIcon

Source§

impl From<&'static [u8]> for WindowIcon

Source§

fn from(data: &'static [u8]) -> Self

From encoded data of Unknown format.

Source§

impl<const N: usize> From<&'static [u8; N]> for WindowIcon

Source§

fn from(data: &'static [u8; N]) -> Self

From encoded data of Unknown format.

Source§

impl From<&Path> for WindowIcon

Source§

fn from(path: &Path) -> Self

Converts to this type from the input type.
Source§

impl From<&str> for WindowIcon

Source§

fn from(s: &str) -> Self

See ImageSource conversion from &str

Source§

impl<F: Into<ImageDataFormat>> From<(&'static [u8], F)> for WindowIcon

Source§

fn from((data, format): (&'static [u8], F)) -> Self

From encoded data of known format.

Source§

impl<F: Into<ImageDataFormat>, const N: usize> From<(&'static [u8; N], F)> for WindowIcon

Source§

fn from((data, format): (&'static [u8; N], F)) -> Self

From encoded data of known format.

Source§

impl<F: Into<ImageDataFormat>> From<(Arc<Vec<u8>>, F)> for WindowIcon

Source§

fn from((data, format): (Arc<Vec<u8>>, F)) -> Self

From encoded data of known format.

Source§

impl<F: Into<ImageDataFormat>> From<(Vec<u8>, F)> for WindowIcon

Source§

fn from((data, format): (Vec<u8>, F)) -> Self

From encoded data of known format.

Source§

impl From<Arc<Vec<u8>>> for WindowIcon

Source§

fn from(data: Arc<Vec<u8>>) -> Self

From encoded data of Unknown format.

Source§

impl From<ImageSource> for WindowIcon

Source§

fn from(source: ImageSource) -> Self

Converts to this type from the input type.
Source§

impl From<PathBuf> for WindowIcon

Source§

fn from(path: PathBuf) -> Self

Converts to this type from the input type.
Source§

impl From<String> for WindowIcon

Source§

fn from(s: String) -> Self

Same as conversion from &str.

Source§

impl From<Txt> for WindowIcon

Source§

fn from(s: Txt) -> Self

Same as conversion from &str.

Source§

impl From<Uri> for WindowIcon

Source§

fn from(uri: Uri) -> Self

Converts to this type from the input type.
Source§

impl From<Var<Img>> for WindowIcon

Source§

fn from(image: ImageVar) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for WindowIcon

Source§

fn from(data: Vec<u8>) -> Self

From encoded data of Unknown format.

Source§

impl IntoVar<WindowIcon> for &'static [u8]

Source§

fn into_var(self) -> Var<WindowIcon>

From encoded data of Unknown format.

Source§

impl<const N: usize> IntoVar<WindowIcon> for &'static [u8; N]

Source§

fn into_var(self) -> Var<WindowIcon>

From encoded data of Unknown format.

Source§

impl IntoVar<WindowIcon> for &Path

Source§

impl IntoVar<WindowIcon> for &str

Source§

fn into_var(self) -> Var<WindowIcon>

See ImageSource conversion from &str

Source§

impl<F: Into<ImageDataFormat>> IntoVar<WindowIcon> for (&'static [u8], F)

Source§

fn into_var(self) -> Var<WindowIcon>

From encoded data of known format.

Source§

impl<F: Into<ImageDataFormat>, const N: usize> IntoVar<WindowIcon> for (&'static [u8; N], F)

Source§

fn into_var(self) -> Var<WindowIcon>

From encoded data of known format.

Source§

impl<F: Into<ImageDataFormat>> IntoVar<WindowIcon> for (Arc<Vec<u8>>, F)

Source§

fn into_var(self) -> Var<WindowIcon>

From encoded data of known format.

Source§

impl<F: Into<ImageDataFormat>> IntoVar<WindowIcon> for (Vec<u8>, F)

Source§

fn into_var(self) -> Var<WindowIcon>

From encoded data of known format.

Source§

impl IntoVar<WindowIcon> for Arc<Vec<u8>>

Source§

fn into_var(self) -> Var<WindowIcon>

From encoded data of Unknown format.

Source§

impl IntoVar<WindowIcon> for ImageSource

Source§

impl IntoVar<WindowIcon> for PathBuf

Source§

impl IntoVar<WindowIcon> for String

Source§

fn into_var(self) -> Var<WindowIcon>

Same as conversion from &str.

Source§

impl IntoVar<WindowIcon> for Txt

Source§

fn into_var(self) -> Var<WindowIcon>

Same as conversion from &str.

Source§

impl IntoVar<WindowIcon> for Uri

Source§

impl IntoVar<WindowIcon> for ImageVar

Source§

impl IntoVar<WindowIcon> for Vec<u8>

Source§

fn into_var(self) -> Var<WindowIcon>

From encoded data of Unknown format.

Source§

impl PartialEq for WindowIcon

Source§

fn eq(&self, other: &WindowIcon) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl IntoValue<WindowIcon> for &'static [u8]

Source§

impl<const N: usize> IntoValue<WindowIcon> for &'static [u8; N]

Source§

impl IntoValue<WindowIcon> for &Path

Source§

impl IntoValue<WindowIcon> for &str

Source§

impl<F: Into<ImageDataFormat>> IntoValue<WindowIcon> for (&'static [u8], F)

Source§

impl<F: Into<ImageDataFormat>, const N: usize> IntoValue<WindowIcon> for (&'static [u8; N], F)

Source§

impl<F: Into<ImageDataFormat>> IntoValue<WindowIcon> for (Arc<Vec<u8>>, F)

Source§

impl<F: Into<ImageDataFormat>> IntoValue<WindowIcon> for (Vec<u8>, F)

Source§

impl IntoValue<WindowIcon> for Arc<Vec<u8>>

Source§

impl IntoValue<WindowIcon> for ImageSource

Source§

impl IntoValue<WindowIcon> for PathBuf

Source§

impl IntoValue<WindowIcon> for String

Source§

impl IntoValue<WindowIcon> for Txt

Source§

impl IntoValue<WindowIcon> for Uri

Source§

impl IntoValue<WindowIcon> for ImageVar

Source§

impl IntoValue<WindowIcon> for Vec<u8>

Source§

impl StructuralPartialEq for WindowIcon

Auto Trait Implementations§

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> AnyVarValue for T
where T: Debug + PartialEq + Clone + Any + Send + Sync,

Source§

fn clone_boxed(&self) -> BoxAnyVarValue

Clone the value.
Source§

fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool

Gets if self and other are equal.
Source§

fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool

Swap value with other if both are of the same type.
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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoVar<T> for T
where T: VarValue,

Source§

fn into_var(self) -> Var<T>

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> IntoValue<T> for T
where T: VarValue,

Source§

impl<T> StateValue for T
where T: Any + Send + Sync,

Source§

impl<T> VarValue for T