mads_core/configuration/
secret.rs1use std::fmt;
4
5#[derive(Clone, PartialEq, Eq)]
10pub struct Secret<T>(T);
11
12impl<T> Secret<T> {
13 pub fn new(value: T) -> Self {
15 Self(value)
16 }
17
18 pub fn expose(&self) -> &T {
20 &self.0
21 }
22
23 pub fn into_exposed(self) -> T {
25 self.0
26 }
27}
28
29impl<T> fmt::Debug for Secret<T> {
30 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
31 formatter.write_str("[REDACTED]")
32 }
33}
34
35impl<T> fmt::Display for Secret<T> {
36 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
37 formatter.write_str("[REDACTED]")
38 }
39}