Cred

Struct Cred 

Source
pub struct Cred {
    pub specifiers: (String, String),
    pub inner: Mutex<RefCell<CredData>>,
}
Expand description

The concrete mock credential

Mocks use an internal mutability pattern since entries are read-only. The mutex is used to make sure these are Sync.

Fields§

§specifiers: (String, String)§inner: Mutex<RefCell<CredData>>

Implementations§

Source§

impl Cred

Source

pub fn set_error(&self, err: Error)

Set an error to be returned from this mock credential.

Error returns always take precedence over the normal behavior of the mock. But once an error has been returned, it is removed, so the mock works thereafter.

Trait Implementations§

Source§

impl CredentialApi for Cred

Source§

fn set_secret(&self, secret: &[u8]) -> Result<()>

See the API docs.

If there is an error in the mock, it will be returned and the secret will not be set. The error will be cleared, so calling again will set the secret.

Source§

fn get_secret(&self) -> Result<Vec<u8>>

See the API docs.

If there is an error set in the mock, it will be returned instead of a secret. The existing secret will not change.

Source§

fn delete_credential(&self) -> Result<()>

See the API docs.

If there is an error, it will be returned and cleared. Calling again will delete the cred.

Source§

fn get_credential(&self) -> Result<Option<Arc<Credential>>>

See the API docs.

If there is an error in the mock, it’s returned instead and cleared. Calling again will retry the operation.

Source§

fn get_specifiers(&self) -> Option<(String, String)>

See the API docs.

Source§

fn as_any(&self) -> &dyn Any

Return this mock credential concrete object wrapped in the Any trait, so it can be downcast.

Source§

fn debug_fmt(&self, f: &mut Formatter<'_>) -> Result

Expose the concrete debug formatter for use via the Credential trait

Source§

fn set_password(&self, password: &str) -> Result<()>

Set the entry’s protected data to be the given string. Read more
Source§

fn get_password(&self) -> Result<String>

Retrieve the protected data as a UTF-8 string from the underlying credential. Read more
Source§

fn get_attributes(&self) -> Result<HashMap<String, String>>

Return any store-specific decorations on this entry’s credential. Read more
Source§

fn update_attributes(&self, _: &HashMap<&str, &str>) -> Result<()>

Update the secure store attributes on this entry’s credential. Read more
Source§

impl Debug for Cred

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Cred

§

impl RefUnwindSafe for Cred

§

impl Send for Cred

§

impl Sync for Cred

§

impl Unpin for Cred

§

impl UnwindSafe for Cred

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.