1use proptest_derive::Arbitrary;
11use serde::{Deserialize, Serialize};
12use std::fmt::{Debug, Display};
13
14use static_assertions::assert_not_impl_all;
15
16#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, PartialOrd, Ord, Arbitrary)]
18pub struct Password(pub String);
19
20assert_not_impl_all!(Password: Display);
21
22impl From<String> for Password {
23 fn from(password: String) -> Self {
24 Password(password)
25 }
26}
27
28impl From<&str> for Password {
29 fn from(password: &str) -> Self {
30 Password(password.to_string())
31 }
32}
33
34impl ToString for Password {
35 fn to_string(&self) -> String {
36 self.0.clone()
37 }
38}
39
40impl Debug for Password {
41 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
42 write!(f, "Password(****)")
43 }
44}