pub struct StateStore { /* private fields */ }Expand description
state store wrapper with load/save helpers.
Implementations§
Source§impl StateStore
impl StateStore
Sourcepub fn new(backend: Option<Arc<dyn StateBackend>>, data: StateData) -> Self
pub fn new(backend: Option<Arc<dyn StateBackend>>, data: StateData) -> Self
create a new state store with an optional backend.
Sourcepub async fn load_postgres(
url: impl Into<String>,
key: impl Into<String>,
tls_mode: PostgresTlsMode,
) -> Result<Self>
pub async fn load_postgres( url: impl Into<String>, key: impl Into<String>, tls_mode: PostgresTlsMode, ) -> Result<Self>
load state from a postgres backend.
Sourcepub async fn load_async(&mut self) -> Result<()>
pub async fn load_async(&mut self) -> Result<()>
load state from the configured backend.
Sourcepub async fn save_async(&self) -> Result<()>
pub async fn save_async(&self) -> Result<()>
persist state to the configured backend.
Sourcepub fn backend_id(&self, type_name: TypeName, uid: Uid) -> Option<BackendId>
pub fn backend_id(&self, type_name: TypeName, uid: Uid) -> Option<BackendId>
lookup a backend id by type + uid.
Sourcepub fn set_backend_id(
&mut self,
type_name: TypeName,
uid: Uid,
backend_id: BackendId,
)
pub fn set_backend_id( &mut self, type_name: TypeName, uid: Uid, backend_id: BackendId, )
set a backend id mapping.
Sourcepub fn remove_backend_id(&mut self, type_name: TypeName, uid: Uid)
pub fn remove_backend_id(&mut self, type_name: TypeName, uid: Uid)
remove a backend id mapping.
Trait Implementations§
Source§impl Clone for StateStore
impl Clone for StateStore
Source§fn clone(&self) -> StateStore
fn clone(&self) -> StateStore
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 moreAuto Trait Implementations§
impl Freeze for StateStore
impl !RefUnwindSafe for StateStore
impl Send for StateStore
impl Sync for StateStore
impl Unpin for StateStore
impl UnsafeUnpin for StateStore
impl !UnwindSafe for StateStore
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