pub struct MemoryStore { /* private fields */ }Expand description
In-memory credential store for testing.
This store keeps credentials in memory wrapped in SecretString
(zeroize-on-drop, redacted Debug) for unit tests that don’t want
to interact with the real OS keychain. The Debug impl shows the
key set and a count, never the values, so accidentally logging a
MemoryStore cannot leak plaintext.
Implementations§
Source§impl MemoryStore
impl MemoryStore
Sourcepub fn with_credentials(
credentials: impl IntoIterator<Item = (String, String)>,
) -> Self
pub fn with_credentials( credentials: impl IntoIterator<Item = (String, String)>, ) -> Self
Create a store pre-populated with credentials. Accepts plaintext
(key, value) pairs for test ergonomics; the values are wrapped
in SecretString before storage.
Trait Implementations§
Source§impl CredentialStore for MemoryStore
impl CredentialStore for MemoryStore
Source§fn store(&self, key: &str, value: &SecretString) -> Result<()>
fn store(&self, key: &str, value: &SecretString) -> Result<()>
Store a credential securely. Read more
Source§fn get(&self, key: &str) -> Result<Option<SecretString>>
fn get(&self, key: &str) -> Result<Option<SecretString>>
Retrieve a stored credential. Read more
Source§fn is_available(&self) -> bool
fn is_available(&self) -> bool
Check if this credential store is available and functional. Read more
Source§fn is_writable(&self) -> bool
fn is_writable(&self) -> bool
Check if this store supports write operations. Read more
Source§impl Debug for MemoryStore
impl Debug for MemoryStore
Source§impl Default for MemoryStore
impl Default for MemoryStore
Source§fn default() -> MemoryStore
fn default() -> MemoryStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for MemoryStore
impl RefUnwindSafe for MemoryStore
impl Send for MemoryStore
impl Sync for MemoryStore
impl Unpin for MemoryStore
impl UnsafeUnpin for MemoryStore
impl UnwindSafe for MemoryStore
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