fxa_client/state_machine/
display.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5//! Display impls for state machine types
6//!
7//! These are sent to Sentry, so they must not leak PII.
8//! In general this means they don't output values for inner fields.
9
10use super::{FxaEvent, FxaState};
11use std::fmt;
12
13impl fmt::Display for FxaState {
14    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15        let name = match self {
16            Self::Uninitialized => "Uninitialized",
17            Self::Disconnected => "Disconnected",
18            Self::Authenticating { .. } => "Authenticating",
19            Self::Connected => "Connected",
20            Self::AuthIssues => "AuthIssues",
21        };
22        write!(f, "{name}")
23    }
24}
25
26impl fmt::Display for FxaEvent {
27    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
28        let name = match self {
29            Self::Initialize { .. } => "Initialize",
30            Self::BeginOAuthFlow { .. } => "BeginOAuthFlow",
31            Self::BeginPairingFlow { .. } => "BeginPairingFlow",
32            Self::CompleteOAuthFlow { .. } => "CompleteOAuthFlow",
33            Self::CancelOAuthFlow => "CancelOAuthFlow",
34            Self::CheckAuthorizationStatus => "CheckAuthorizationStatus",
35            Self::WebChannelPasswordChange { .. } => "WebChannelPwdChange",
36            Self::Disconnect => "Disconnect",
37            Self::CallGetProfile => "CallGetProfile",
38        };
39        write!(f, "{name}")
40    }
41}