3 ops::{Deref, DerefMut},
6 #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, serde::Deserialize, serde::Serialize)]
8 pub struct Sensitive<T>(T);
10 impl<T> Sensitive<T> {
11 pub fn new(item: T) -> Self {
15 pub fn into_inner(this: Self) -> T {
20 impl<T> std::fmt::Debug for Sensitive<T> {
21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 f.debug_struct("Sensitive").finish()
26 impl<T> AsRef<T> for Sensitive<T> {
27 fn as_ref(&self) -> &T {
32 impl AsRef<str> for Sensitive<String> {
33 fn as_ref(&self) -> &str {
38 impl AsRef<[u8]> for Sensitive<String> {
39 fn as_ref(&self) -> &[u8] {
44 impl AsRef<[u8]> for Sensitive<Vec<u8>> {
45 fn as_ref(&self) -> &[u8] {
50 impl<T> AsMut<T> for Sensitive<T> {
51 fn as_mut(&mut self) -> &mut T {
56 impl AsMut<str> for Sensitive<String> {
57 fn as_mut(&mut self) -> &mut str {
62 impl Deref for Sensitive<String> {
65 fn deref(&self) -> &Self::Target {
70 impl DerefMut for Sensitive<String> {
71 fn deref_mut(&mut self) -> &mut Self::Target {
76 impl<T> From<T> for Sensitive<T> {
77 fn from(t: T) -> Self {
82 impl From<&str> for Sensitive<String> {
83 fn from(s: &str) -> Self {
88 impl<T> Borrow<T> for Sensitive<T> {
89 fn borrow(&self) -> &T {
94 impl Borrow<str> for Sensitive<String> {
95 fn borrow(&self) -> &str {