Skip to main content

limes_proto/
lock.rs

1use std::fmt;
2
3/// Lock state as understood by UI frontends.
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub enum LockState {
6    /// Display backend failed; the effective lock status is indeterminate.
7    Unknown,
8    Unlocked,
9    Locking,
10    Locked,
11    Unlocking,
12}
13
14impl fmt::Display for LockState {
15    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16        match self {
17            Self::Unknown => f.write_str("unknown"),
18            Self::Unlocked => f.write_str("unlocked"),
19            Self::Locking => f.write_str("locking"),
20            Self::Locked => f.write_str("locked"),
21            Self::Unlocking => f.write_str("unlocking"),
22        }
23    }
24}