Skip to content

Commit

Permalink
Fix features
Browse files Browse the repository at this point in the history
  • Loading branch information
eopb committed Jul 16, 2023
1 parent 8e14b1a commit 84c0b00
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,15 @@ struct Test {
two: Option<Secret<String>>,
}

#[cfg(feature = "serde")]
pub trait ContainsSecret<T> {
type Exposed<'a>: Serialize
where
Self: 'a;
fn expose_secret<'a>(&'a self, expose: impl Fn(&Secret<T>) -> &T) -> Self::Exposed<'a>;
}

#[cfg(feature = "serde")]
impl<T: Serialize> ContainsSecret<T> for Secret<T> {
type Exposed<'a> = &'a T where T: 'a;

Expand All @@ -207,6 +209,7 @@ impl<T: Serialize> ContainsSecret<T> for Secret<T> {
}
}

#[cfg(feature = "serde")]
impl<T: Serialize> ContainsSecret<T> for Option<Secret<T>> {
type Exposed<'a> = Option<&'a T> where T: 'a;

Expand Down

0 comments on commit 84c0b00

Please sign in to comment.