#[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§
Source§impl<'de> Deserialize<'de> for IconData
impl<'de> Deserialize<'de> for IconData
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<IconData, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<IconData, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for IconData
impl Serialize for IconData
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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