Struct tor_persist::TestingStateMgr
source · pub struct TestingStateMgr { /* private fields */ }
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.
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.
Trait Implementations§
source§impl Clone for TestingStateMgr
impl Clone for TestingStateMgr
source§fn clone(&self) -> TestingStateMgr
fn clone(&self) -> TestingStateMgr
Returns a copy 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
§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