freya-core 0.4.0-rc.7

Reactivity runtime, tree management, accessibility integration, rendering pipeline and more, for Freya
Documentation
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub enum Focusable {
    #[default]
    Unknown,
    Disabled,
    Enabled,
}

impl From<bool> for Focusable {
    fn from(value: bool) -> Self {
        if value {
            Focusable::Enabled
        } else {
            Focusable::Disabled
        }
    }
}

impl Focusable {
    pub fn is_unknown(&self) -> bool {
        matches!(self, Self::Unknown)
    }

    pub fn is_enabled(&self) -> bool {
        matches!(self, Self::Enabled)
    }
}