1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
use basws_shared::{protocol::InstallationConfig, Uuid};
use std::fmt::Debug;

#[derive(Debug, Clone)]
pub enum LoginState {
    Disconnected,
    Handshaking { config: Option<InstallationConfig> },
    Connected { installation_id: Uuid },
    Error { message: Option<String> },
}

impl Default for LoginState {
    fn default() -> Self {
        LoginState::Disconnected
    }
}

impl LoginState {
    pub fn is_connected(&self) -> bool {
        matches!(self, LoginState::Connected { .. })
    }
}