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