pub struct PasswordConfig(pub Secret);
Expand description
The password configuration.
Tuple Fields§
§0: Secret
Implementations§
Methods from Deref<Target = Secret>§
Sourcepub async fn get(&self) -> Result<String, Error>
pub async fn get(&self) -> Result<String, Error>
Gets the secret value.
The command-based secret execute its shell command and returns the output, and the keyring-based secret retrieves the value from the global keyring using its inner key.
Sourcepub async fn find(&self) -> Result<Option<String>, Error>
pub async fn find(&self) -> Result<Option<String>, Error>
Finds the secret value.
Like Secret::get
, but returns None
if the secret value
is not found or empty.
Sourcepub async fn set(&mut self, secret: impl ToString) -> Result<String, Error>
pub async fn set(&mut self, secret: impl ToString) -> Result<String, Error>
Updates the secret value.
This is only applicable for raw secrets and keyring-based secrets. A secret value cannot be changed for command-base secrets, since the value is the output of the command.
Sourcepub async fn set_if_keyring(
&self,
secret: impl ToString,
) -> Result<String, Error>
pub async fn set_if_keyring( &self, secret: impl ToString, ) -> Result<String, Error>
Updates the secret value of the keyring-based secret only.
This function as no effect on other secret variants.
Sourcepub async fn delete(&mut self) -> Result<(), Error>
pub async fn delete(&mut self) -> Result<(), Error>
Deletes the secret value and make the current secret empty.
Sourcepub async fn delete_if_keyring(&self) -> Result<(), Error>
pub async fn delete_if_keyring(&self) -> Result<(), Error>
Deletes the secret value of keyring-based secrets only.
This function has no effect on other variants.
Sourcepub fn replace_if_empty(&mut self, new: Secret)
pub fn replace_if_empty(&mut self, new: Secret)
Replaces empty secret variant with the given one.
This function has no effect on other variants.
Trait Implementations§
Source§impl Clone for PasswordConfig
impl Clone for PasswordConfig
Source§fn clone(&self) -> PasswordConfig
fn clone(&self) -> PasswordConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PasswordConfig
impl Debug for PasswordConfig
Source§impl Default for PasswordConfig
impl Default for PasswordConfig
Source§fn default() -> PasswordConfig
fn default() -> PasswordConfig
Source§impl Deref for PasswordConfig
impl Deref for PasswordConfig
Source§impl DerefMut for PasswordConfig
impl DerefMut for PasswordConfig
Source§impl<'de> Deserialize<'de> for PasswordConfig
impl<'de> Deserialize<'de> for PasswordConfig
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>,
Source§impl PartialEq for PasswordConfig
impl PartialEq for PasswordConfig
Source§impl Serialize for PasswordConfig
impl Serialize for PasswordConfig
impl Eq for PasswordConfig
impl StructuralPartialEq for PasswordConfig
Auto Trait Implementations§
impl Freeze for PasswordConfig
impl !RefUnwindSafe for PasswordConfig
impl Send for PasswordConfig
impl Sync for PasswordConfig
impl Unpin for PasswordConfig
impl !UnwindSafe for PasswordConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more