#[non_exhaustive]pub enum IconData {
Svg(Vec<u8>),
Rgba {
width: u32,
height: u32,
data: Vec<u8>,
},
}Expand description
Icon data returned by loading functions.
Represents the actual pixel or vector data for an icon. This type is produced by platform icon loaders and bundled icon accessors.
§Examples
use native_theme::IconData;
let svg = IconData::Svg(b"<svg></svg>".to_vec());
match svg {
IconData::Svg(bytes) => assert!(!bytes.is_empty()),
_ => unreachable!(),
}
let rgba = IconData::Rgba { width: 16, height: 16, data: vec![0; 16*16*4] };
match rgba {
IconData::Rgba { width, height, .. } => {
assert_eq!(width, 16);
assert_eq!(height, 16);
}
_ => unreachable!(),
}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.
Svg(Vec<u8>)
SVG content as raw bytes (from freedesktop themes, bundled icon sets).
Rgba
Rasterized RGBA pixels (from macOS/Windows system APIs).
Trait Implementations§
impl Eq for IconData
impl StructuralPartialEq for IconData
Auto Trait Implementations§
impl Freeze for IconData
impl RefUnwindSafe for IconData
impl Send for IconData
impl Sync for IconData
impl Unpin for IconData
impl UnsafeUnpin for IconData
impl UnwindSafe for IconData
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
Mutably borrows from an owned value. Read more