Struct smart_config::de::FromSecretString
source · pub struct FromSecretString;
Expand description
Deserializer for secret strings (any type convertible from SecretString
, including SecretString
itself).
Will set the corresponding flag for ParamMetadata
, making raw param value hidden in the debug output etc.
§Examples
use secrecy::ExposeSecret;
#[derive(DescribeConfig, DeserializeConfig)]
struct TestConfig {
secret: secrecy::SecretString,
}
let input = smart_config::config!("secret": "correct horse battery staple");
let config: TestConfig = testing::test(input)?;
assert_eq!(config.secret.expose_secret(), "correct horse battery staple");
Trait Implementations§
source§impl Debug for FromSecretString
impl Debug for FromSecretString
source§impl<T: From<SecretString> + ExposeSecret<str>> DeserializeParam<T> for FromSecretString
impl<T: From<SecretString> + ExposeSecret<str>> DeserializeParam<T> for FromSecretString
source§const EXPECTING: BasicTypes = BasicTypes::STRING
const EXPECTING: BasicTypes = BasicTypes::STRING
Describes which parameter this deserializer is expecting.
source§fn describe(&self, description: &mut TypeDescription)
fn describe(&self, description: &mut TypeDescription)
Additional info about the deserialized type, e.g., extended description.
source§fn deserialize_param(
&self,
ctx: DeserializeContext<'_>,
param: &'static ParamMetadata,
) -> Result<T, ErrorWithOrigin>
fn deserialize_param( &self, ctx: DeserializeContext<'_>, param: &'static ParamMetadata, ) -> Result<T, ErrorWithOrigin>
Performs deserialization given the context and param metadata. Read more
Auto Trait Implementations§
impl Freeze for FromSecretString
impl RefUnwindSafe for FromSecretString
impl Send for FromSecretString
impl Sync for FromSecretString
impl Unpin for FromSecretString
impl UnwindSafe for FromSecretString
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more