secrecy/
string.rs

1//! Secret strings
2
3use super::{CloneableSecret, DebugSecret, Secret};
4use alloc::str::FromStr;
5use alloc::string::{String, ToString};
6
7/// Secret strings
8#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
9pub type SecretString = Secret<String>;
10
11impl DebugSecret for String {}
12impl CloneableSecret for String {}
13
14impl FromStr for SecretString {
15    type Err = core::convert::Infallible;
16
17    fn from_str(src: &str) -> Result<Self, Self::Err> {
18        Ok(SecretString::new(src.to_string()))
19    }
20}