pub struct State<'a> { /* private fields */ }Expand description
State manager providing state operations with EncodedKey and EncodedValues
Implementations§
Source§impl<'a> State<'a>
impl<'a> State<'a>
Sourcepub fn get(&self, key: &EncodedKey) -> Result<Option<EncodedValues>>
pub fn get(&self, key: &EncodedKey) -> Result<Option<EncodedValues>>
Get a value from state by key
Sourcepub fn set(&mut self, key: &EncodedKey, value: &EncodedValues) -> Result<()>
pub fn set(&mut self, key: &EncodedKey, value: &EncodedValues) -> Result<()>
Set a value in state by key
Sourcepub fn remove(&mut self, key: &EncodedKey) -> Result<()>
pub fn remove(&mut self, key: &EncodedKey) -> Result<()>
Remove a value from state by key
Sourcepub fn contains(&self, key: &EncodedKey) -> Result<bool>
pub fn contains(&self, key: &EncodedKey) -> Result<bool>
Check if a key exists in state
Sourcepub fn scan_prefix(
&self,
prefix: &EncodedKey,
) -> Result<Vec<(EncodedKey, EncodedValues)>>
pub fn scan_prefix( &self, prefix: &EncodedKey, ) -> Result<Vec<(EncodedKey, EncodedValues)>>
Scan state entries with a given key prefix
Sourcepub fn keys_with_prefix(&self, prefix: &EncodedKey) -> Result<Vec<EncodedKey>>
pub fn keys_with_prefix(&self, prefix: &EncodedKey) -> Result<Vec<EncodedKey>>
Get all keys with a given prefix
Auto Trait Implementations§
impl<'a> Freeze for State<'a>
impl<'a> RefUnwindSafe for State<'a>
impl<'a> !Send for State<'a>
impl<'a> !Sync for State<'a>
impl<'a> Unpin for State<'a>
impl<'a> !UnwindSafe for State<'a>
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