initial commit

This commit is contained in:
Sampras Lopes
2022-11-16 20:37:50 +05:30
commit 430dcd1967
320 changed files with 64760 additions and 0 deletions

View File

@ -0,0 +1,39 @@
//!
//! Secret strings
//!
//! There is not alias type by design.
use alloc::{
str::FromStr,
string::{String, ToString},
};
#[cfg(feature = "serde")]
use super::SerializableSecret;
use super::{Secret, Strategy};
use crate::StrongSecret;
#[cfg(feature = "serde")]
impl SerializableSecret for String {}
impl<I> FromStr for Secret<String, I>
where
I: Strategy<String>,
{
type Err = core::convert::Infallible;
fn from_str(src: &str) -> Result<Self, Self::Err> {
Ok(Secret::<String, I>::new(src.to_string()))
}
}
impl<I> FromStr for StrongSecret<String, I>
where
I: Strategy<String>,
{
type Err = core::convert::Infallible;
fn from_str(src: &str) -> Result<Self, Self::Err> {
Ok(StrongSecret::<String, I>::new(src.to_string()))
}
}