It would be convenient to have a utility function for mapping the value inside of a secret, basically following this signature:
fn map<F, U>(self, mapper: F) -> Secret<U>
where F: FnOnce(T) -> U
My specific use case is that I have a Secret<&str> and I need a Secret<Cow<'a, str>> and it's messy to have to do something like
Secret::new(Cow::Borrowed(secret.expose_secret()))
where something like this could be better:
secret.map(Cow::Borrowed)
It would be convenient to have a utility function for mapping the value inside of a secret, basically following this signature:
My specific use case is that I have a
Secret<&str>and I need aSecret<Cow<'a, str>>and it's messy to have to do something likewhere something like this could be better: