Newer
Older
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub enum IconContent {
Image(String),
Atlas(String, usize),
#[default]
None,
}
impl IconContent {
pub fn image(src: impl ToString) -> Self {
Self::Image(src.to_string())
}
pub fn atlas(src: impl ToString, idx: usize) -> Self {
Self::Atlas(src.to_string(), idx)
}
pub fn none() -> Self {
Self::None
}
pub fn is_none(&self) -> bool {
match self {
Self::None => true,
_ => false,
}
}
}