pub struct TestCustody { /* private fields */ }Expand description
In-memory MasterKeyCustody for tests, with a switch to force persist
to fail. The switch models a device whose keyring is momentarily
unwritable, so a test can drive a key adoption into its failure path and then
clear the switch to prove the retry converges. Stores the serialized form
(like the real Keyring preset), so stored_key reflects exactly what a
caller wrote.
Implementations§
Source§impl TestCustody
impl TestCustody
pub fn set_initial_key(&self, key: [u8; 32])
pub fn stored_key(&self) -> Option<String>
Sourcepub fn fail_writes(&self)
pub fn fail_writes(&self)
Make the next and every subsequent persist fail until cleared.
Sourcepub fn allow_writes(&self)
pub fn allow_writes(&self)
Let persist succeed again.
Trait Implementations§
Source§impl Clone for TestCustody
impl Clone for TestCustody
Source§fn clone(&self) -> TestCustody
fn clone(&self) -> TestCustody
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for TestCustody
impl Default for TestCustody
Source§fn default() -> TestCustody
fn default() -> TestCustody
Returns the “default value” for a type. Read more
Source§impl MasterKeyCustody for TestCustody
impl MasterKeyCustody for TestCustody
Source§fn unlock(&self) -> Result<Option<MasterKeyring>, KeyError>
fn unlock(&self) -> Result<Option<MasterKeyring>, KeyError>
The store’s master keyring for this session.
Ok(None) means the store
has never had one established (a fresh store before create/join) —
distinct from a failure to produce one (wrong passphrase, unreadable
backing store), which is Err.Auto Trait Implementations§
impl Freeze for TestCustody
impl RefUnwindSafe for TestCustody
impl Send for TestCustody
impl Sync for TestCustody
impl Unpin for TestCustody
impl UnsafeUnpin for TestCustody
impl UnwindSafe for TestCustody
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.