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//!
10//! Also, they must not use the string "auth" since Sentry will filter that out.
11//! Use "ath" instead.
12
13use super::{FxaEvent, FxaState};
14use std::fmt;
15
16impl fmt::Display for FxaState {
17    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
18        let name = match self {
19            Self::Uninitialized => "Uninitialized",
20            Self::Disconnected => "Disconnected",
21            Self::Authenticating { .. } => "Athenticating",
22            Self::Connected => "Connected",
23            Self::AuthIssues => "AthIssues",
24        };
25        write!(f, "{name}")
26    }
27}
28
29impl fmt::Display for FxaEvent {
30    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
31        let name = match self {
32            Self::Initialize { .. } => "Initialize",
33            Self::BeginOAuthFlow { .. } => "BeginOAthFlow",
34            Self::BeginPairingFlow { .. } => "BeginPairingFlow",
35            Self::CompleteOAuthFlow { .. } => "CompleteOAthFlow",
36            Self::CancelOAuthFlow => "CancelOAthFlow",
37            Self::CheckAuthorizationStatus => "CheckAuthorizationStatus",
38            Self::WebChannelPasswordChange { .. } => "WebChannelPwdChange",
39            Self::Disconnect => "Disconnect",
40            Self::CallGetProfile => "CallGetProfile",
41        };
42        write!(f, "{name}")
43    }
44}