use core::fmt; /// Debugging trait which is specialized for handling secret values pub trait Strategy { /// Format information about the secret's type. fn fmt(value: &T, fmt: &mut fmt::Formatter<'_>) -> fmt::Result; } /// Debug with type #[cfg_attr(feature = "serde", derive(serde::Deserialize))] #[derive(Debug, Copy, Clone, PartialEq)] pub enum WithType {} impl Strategy for WithType { fn fmt(_: &T, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.write_str("*** ")?; fmt.write_str(std::any::type_name::())?; fmt.write_str(" ***") } } /// Debug without type pub enum WithoutType {} impl Strategy for WithoutType { fn fmt(_: &T, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.write_str("*** ***") } }