fxa_client/state_machine/
display.rsuse super::{internal_machines, FxaEvent, FxaState};
use std::fmt;
impl fmt::Display for FxaState {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let name = match self {
Self::Uninitialized => "Uninitialized",
Self::Disconnected => "Disconnected",
Self::Authenticating { .. } => "Athenticating",
Self::Connected => "Connected",
Self::AuthIssues => "AthIssues",
};
write!(f, "{name}")
}
}
impl fmt::Display for FxaEvent {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let name = match self {
Self::Initialize { .. } => "Initialize",
Self::BeginOAuthFlow { .. } => "BeginOAthFlow",
Self::BeginPairingFlow { .. } => "BeginPairingFlow",
Self::CompleteOAuthFlow { .. } => "CompleteOAthFlow",
Self::CancelOAuthFlow => "CancelOAthFlow",
Self::CheckAuthorizationStatus => "CheckAuthorizationStatus",
Self::Disconnect => "Disconnect",
Self::CallGetProfile => "CallGetProfile",
};
write!(f, "{name}")
}
}
impl fmt::Display for internal_machines::State {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::GetAuthState => write!(f, "GetAthState"),
Self::BeginOAuthFlow { .. } => write!(f, "BeginOAthFlow"),
Self::BeginPairingFlow { .. } => write!(f, "BeginPairingFlow"),
Self::CompleteOAuthFlow { .. } => write!(f, "CompleteOAthFlow"),
Self::InitializeDevice => write!(f, "InitializeDevice"),
Self::EnsureDeviceCapabilities => write!(f, "EnsureDeviceCapabilities"),
Self::CheckAuthorizationStatus => write!(f, "CheckAuthorizationStatus"),
Self::Disconnect => write!(f, "Disconnect"),
Self::GetProfile => write!(f, "GetProfile"),
Self::Complete(state) => write!(f, "Complete({state})"),
Self::Cancel => write!(f, "Cancel"),
}
}
}
impl fmt::Display for internal_machines::Event {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let name = match self {
Self::GetAuthStateSuccess { .. } => "GetAthStateSuccess",
Self::BeginOAuthFlowSuccess { .. } => "BeginOAthFlowSuccess",
Self::BeginPairingFlowSuccess { .. } => "BeginPairingFlowSuccess",
Self::CompleteOAuthFlowSuccess => "CompleteOAthFlowSuccess",
Self::InitializeDeviceSuccess => "InitializeDeviceSuccess",
Self::EnsureDeviceCapabilitiesSuccess => "EnsureDeviceCapabilitiesSuccess",
Self::CheckAuthorizationStatusSuccess { .. } => "CheckAuthorizationStatusSuccess",
Self::DisconnectSuccess => "DisconnectSuccess",
Self::GetProfileSuccess => "GetProfileSuccess",
Self::CallError => "CallError",
Self::EnsureCapabilitiesAuthError => "EnsureCapabilitiesAthError",
};
write!(f, "{name}")
}
}