prusto_rs/
auth.rs

1use std::fmt;
2
3#[derive(Clone)]
4pub enum Auth {
5    Basic(String, Option<String>),
6}
7
8impl Auth {
9    pub fn new_basic(username: impl ToString, password: Option<impl ToString>) -> Auth {
10        Auth::Basic(username.to_string(), password.map(|p| p.to_string()))
11    }
12}
13
14impl fmt::Debug for Auth {
15    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16        match self {
17            Auth::Basic(name, _) => f
18                .debug_struct("BasicAuth")
19                .field("username", name)
20                .field("password", &"******")
21                .finish(),
22        }
23    }
24}