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