pub struct Icon { /* private fields */ }Expand description
An icon used for the window titlebar, taskbar, etc.
Enabling the icon_loading feature provides you with several convenience methods for creating
an Icon from any format supported by the image
crate.
Implementations§
Source§impl Icon
impl Icon
Sourcepub fn from_rgba(
rgba: Vec<u8>,
width: u32,
height: u32,
) -> Result<Icon, BadIcon>
pub fn from_rgba( rgba: Vec<u8>, width: u32, height: u32, ) -> Result<Icon, BadIcon>
Creates an Icon from 32bpp RGBA data.
The length of rgba must be divisible by 4, and width * height must equal
rgba.len() / 4. Otherwise, this will return a BadIcon error.
Sourcepub fn from_path<P>(path: P) -> Result<Icon, ImageError>
pub fn from_path<P>(path: P) -> Result<Icon, ImageError>
Loads an Icon from the path of an image on the filesystem.
Requires the icon_loading feature.
Sourcepub fn from_reader<R>(
reader: R,
format: ImageFormat,
) -> Result<Icon, ImageError>
pub fn from_reader<R>( reader: R, format: ImageFormat, ) -> Result<Icon, ImageError>
Loads an Icon from anything implementing BufRead and Seek.
Requires the icon_loading feature.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Icon, ImageError>
pub fn from_bytes(bytes: &[u8]) -> Result<Icon, ImageError>
Loads an Icon from the unprocessed bytes of an image file.
Uses heuristics to determine format.
Requires the icon_loading feature.
Sourcepub fn from_bytes_with_format(
bytes: &[u8],
format: ImageFormat,
) -> Result<Icon, ImageError>
pub fn from_bytes_with_format( bytes: &[u8], format: ImageFormat, ) -> Result<Icon, ImageError>
Loads an Icon from the unprocessed bytes of an image.
Requires the icon_loading feature.
Trait Implementations§
Source§impl From<DynamicImage> for Icon
Requires the icon_loading feature.
impl From<DynamicImage> for Icon
Requires the icon_loading feature.
Source§fn from(image: DynamicImage) -> Icon
fn from(image: DynamicImage) -> Icon
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SetParameter for T
impl<T> SetParameter for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.