pub struct SecretString(/* private fields */);Expand description
Opaque string that redacts its contents in Debug, Display, and Serialize.
Implementations§
Source§impl SecretString
impl SecretString
Sourcepub fn new(value: impl Into<String>) -> Result<Self, FieldError>
pub fn new(value: impl Into<String>) -> Result<Self, FieldError>
Wrap value without further validation.
Sourcepub fn into_inner(self) -> String
pub fn into_inner(self) -> String
Unwrap the inner string.
Sourcepub fn expose_secret(&self) -> &str
pub fn expose_secret(&self) -> &str
Borrow the secret in plaintext.
Trait Implementations§
Source§impl Clone for SecretString
impl Clone for SecretString
Source§fn clone(&self) -> SecretString
fn clone(&self) -> SecretString
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SecretString
impl Debug for SecretString
Source§impl<'de> Deserialize<'de> for SecretString
impl<'de> Deserialize<'de> for SecretString
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for SecretString
impl Display for SecretString
Source§impl Dump for SecretString
impl Dump for SecretString
Source§fn serialize_dump<S: Serializer>(
&self,
serializer: S,
opts: &DumpOptions,
) -> Result<S::Ok, S::Error>
fn serialize_dump<S: Serializer>( &self, serializer: S, opts: &DumpOptions, ) -> Result<S::Ok, S::Error>
Serialize directly when supported, preserving
dump semantics. Read moreimpl Eq for SecretString
Source§impl PartialEq for SecretString
impl PartialEq for SecretString
Source§impl Schema for SecretString
impl Schema for SecretString
Source§fn schema(_: &mut SchemaRegistry) -> SchemaObject
fn schema(_: &mut SchemaRegistry) -> SchemaObject
The schema definition of this type. Use
SchemaRegistry::subschema for nested types.Source§fn schema_name() -> Option<&'static str>
fn schema_name() -> Option<&'static str>
Stable component name. Named types are emitted once under
components.schemas and referenced with $ref.Source§impl Serialize for SecretString
impl Serialize for SecretString
impl StructuralPartialEq for SecretString
Source§impl TryFrom<String> for SecretString
impl TryFrom<String> for SecretString
Source§impl Validate for SecretString
impl Validate for SecretString
Source§fn prepare(input: &mut Value, ctx: &mut ValidationContext)
fn prepare(input: &mut Value, ctx: &mut ValidationContext)
Check and normalise the raw input for this type in place.
Source§fn validate(&self, _ctx: &mut ValidationContext)
fn validate(&self, _ctx: &mut ValidationContext)
Check invariants of the deserialized value.
Auto Trait Implementations§
impl Freeze for SecretString
impl RefUnwindSafe for SecretString
impl Send for SecretString
impl Sync for SecretString
impl Unpin for SecretString
impl UnsafeUnpin for SecretString
impl UnwindSafe for SecretString
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.