pub struct StateTransaction { /* private fields */ }Expand description
A transaction over AgentState that can be committed or rolled back.
Created via AgentState::transaction(). Writes are staged against an
isolated working copy and only become visible when
commit() is called.
Implementations§
Source§impl StateTransaction
impl StateTransaction
Sourcepub async fn get<T: DeserializeOwned>(&self, key: &str) -> Result<T>
pub async fn get<T: DeserializeOwned>(&self, key: &str) -> Result<T>
Read a value within the transaction.
Sourcepub async fn set<T: Serialize>(&self, key: &str, value: T) -> Result<()>
pub async fn set<T: Serialize>(&self, key: &str, value: T) -> Result<()>
Write a value within the transaction.
Trait Implementations§
Source§impl Drop for StateTransaction
impl Drop for StateTransaction
Auto Trait Implementations§
impl !Freeze for StateTransaction
impl !RefUnwindSafe for StateTransaction
impl !UnwindSafe for StateTransaction
impl Send for StateTransaction
impl Sync for StateTransaction
impl Unpin for StateTransaction
impl UnsafeUnpin for StateTransaction
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