pub struct State<'a> { /* private fields */ }Expand description
State manager providing state operations with EncodedKey and EncodedRow
Implementations§
Source§impl<'a> State<'a>
impl<'a> State<'a>
Sourcepub fn get(&self, key: &EncodedKey) -> Result<Option<EncodedRow>>
pub fn get(&self, key: &EncodedKey) -> Result<Option<EncodedRow>>
Get a value from state by key
Sourcepub fn set(&mut self, key: &EncodedKey, value: &EncodedRow) -> Result<()>
pub fn set(&mut self, key: &EncodedKey, value: &EncodedRow) -> 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, EncodedRow)>>
pub fn scan_prefix( &self, prefix: &EncodedKey, ) -> Result<Vec<(EncodedKey, EncodedRow)>>
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
Sourcepub fn range(
&self,
start: Bound<&EncodedKey>,
end: Bound<&EncodedKey>,
) -> Result<Vec<(EncodedKey, EncodedRow)>>
pub fn range( &self, start: Bound<&EncodedKey>, end: Bound<&EncodedKey>, ) -> Result<Vec<(EncodedKey, EncodedRow)>>
Scan state entries within a given range
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> UnsafeUnpin 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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