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§
Trait Implementations§
Source§impl CredentialApi for Cred
impl CredentialApi for Cred
Source§fn set_secret(&self, secret: &[u8]) -> Result<()>
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>>
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<()>
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>>>
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 as_any(&self) -> &dyn Any
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
fn debug_fmt(&self, f: &mut Formatter<'_>) -> Result
Expose the concrete debug formatter for use via the Credential trait