1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
//! Secret strings

use super::{CloneableSecret, DebugSecret, Secret};
use alloc::str::FromStr;
use alloc::string::{String, ToString};

/// Secret strings
#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
pub type SecretString = Secret<String>;

impl DebugSecret for String {}
impl CloneableSecret for String {}

impl FromStr for SecretString {
    type Err = core::convert::Infallible;

    fn from_str(src: &str) -> Result<Self, Self::Err> {
        Ok(SecretString::new(src.to_string()))
    }
}