freya_core/accessibility/
focusable.rs1#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5#[derive(Debug, Default, Clone, PartialEq, Eq)]
6pub enum Focusable {
7 #[default]
9 Unknown,
10 Disabled,
12 Enabled,
14}
15
16impl From<bool> for Focusable {
17 fn from(value: bool) -> Self {
18 if value {
19 Focusable::Enabled
20 } else {
21 Focusable::Disabled
22 }
23 }
24}
25
26impl Focusable {
27 pub fn is_unknown(&self) -> bool {
28 matches!(self, Self::Unknown)
29 }
30
31 pub fn is_enabled(&self) -> bool {
32 matches!(self, Self::Enabled)
33 }
34}