pub struct TestingStateMgr {
inner: Arc<Mutex<TestingStateMgrInner>>,
}
Available on crate feature
testing
only.Expand description
A state manager for testing support, that allows simulating persistence without having to store anything to disk.
Only available when this crate is built with the testing
feature.
Fields§
§inner: Arc<Mutex<TestingStateMgrInner>>
Inner reference-counted storage.
Implementations§
Source§impl TestingStateMgr
impl TestingStateMgr
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new empty unlocked TestingStateMgr
.
Sourcepub fn new_manager(&self) -> Self
pub fn new_manager(&self) -> Self
Create a new unlocked TestingStateMgr
that shares the same
underlying storage with this one.
Sourcefn err_resource(&self, key: &str) -> Resource
fn err_resource(&self, key: &str) -> Resource
Return an error Resource corresponding to a given key
.
Trait Implementations§
Source§impl Clone for TestingStateMgr
impl Clone for TestingStateMgr
Source§fn clone(&self) -> TestingStateMgr
fn clone(&self) -> TestingStateMgr
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 Debug for TestingStateMgr
impl Debug for TestingStateMgr
Source§impl Default for TestingStateMgr
impl Default for TestingStateMgr
Source§impl StateMgr for TestingStateMgr
impl StateMgr for TestingStateMgr
Source§fn load<D>(&self, key: &str) -> Result<Option<D>, Error>where
D: DeserializeOwned,
fn load<D>(&self, key: &str) -> Result<Option<D>, Error>where
D: DeserializeOwned,
Try to load the object with key
key
from the store. Read moreSource§fn try_lock(&self) -> Result<LockStatus, Error>
fn try_lock(&self) -> Result<LockStatus, Error>
Try to become a read-write state manager if possible, without
blocking. Read more
Source§fn unlock(&self) -> Result<(), Error>
fn unlock(&self) -> Result<(), Error>
Release any locks held and become a read-only state manager
again. If no locks were held, do nothing.
Source§fn create_handle<T>(self, key: impl Into<String>) -> DynStorageHandle<T>
fn create_handle<T>(self, key: impl Into<String>) -> DynStorageHandle<T>
Make a new
StorageHandle
to store values of particular type
at a particular key.Auto Trait Implementations§
impl Freeze for TestingStateMgr
impl RefUnwindSafe for TestingStateMgr
impl Send for TestingStateMgr
impl Sync for TestingStateMgr
impl Unpin for TestingStateMgr
impl UnwindSafe for TestingStateMgr
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 more