pub struct TestStateStore { /* private fields */ }Expand description
Mock state store for testing operators
Implementations§
Source§impl TestStateStore
impl TestStateStore
Sourcepub fn get(&self, key: &EncodedKey) -> Option<&EncodedValues>
pub fn get(&self, key: &EncodedKey) -> Option<&EncodedValues>
Get a value from the store
Sourcepub fn set(&mut self, key: EncodedKey, value: EncodedValues)
pub fn set(&mut self, key: EncodedKey, value: EncodedValues)
Set a value in the store
Sourcepub fn remove(&mut self, key: &EncodedKey) -> Option<EncodedValues>
pub fn remove(&mut self, key: &EncodedKey) -> Option<EncodedValues>
Remove a value from the store
Sourcepub fn contains(&self, key: &EncodedKey) -> bool
pub fn contains(&self, key: &EncodedKey) -> bool
Check if a key exists
Sourcepub fn keys(&self) -> Vec<&EncodedKey>
pub fn keys(&self) -> Vec<&EncodedKey>
Get all keys
Sourcepub fn entries(&self) -> Vec<(&EncodedKey, &EncodedValues)>
pub fn entries(&self) -> Vec<(&EncodedKey, &EncodedValues)>
Get all key-value pairs
Sourcepub fn decode_value(
&self,
key: &EncodedKey,
layout: &EncodedValuesLayout,
) -> Option<Vec<Value>>
pub fn decode_value( &self, key: &EncodedKey, layout: &EncodedValuesLayout, ) -> Option<Vec<Value>>
Decode a value using a layout
Sourcepub fn decode_named_value(
&self,
key: &EncodedKey,
layout: &EncodedValuesNamedLayout,
) -> Option<HashMap<String, Value>>
pub fn decode_named_value( &self, key: &EncodedKey, layout: &EncodedValuesNamedLayout, ) -> Option<HashMap<String, Value>>
Decode a value using a named layout
Sourcepub fn set_value(
&mut self,
key: EncodedKey,
values: &[Value],
layout: &EncodedValuesLayout,
)
pub fn set_value( &mut self, key: EncodedKey, values: &[Value], layout: &EncodedValuesLayout, )
Set a value using a layout
Sourcepub fn set_named_value(
&mut self,
key: EncodedKey,
values: &HashMap<String, Value>,
layout: &EncodedValuesNamedLayout,
)
pub fn set_named_value( &mut self, key: EncodedKey, values: &HashMap<String, Value>, layout: &EncodedValuesNamedLayout, )
Set a value using a named layout
Sourcepub fn snapshot(&self) -> HashMap<EncodedKey, EncodedValues>
pub fn snapshot(&self) -> HashMap<EncodedKey, EncodedValues>
Create a snapshot of the current state
Sourcepub fn restore(&mut self, snapshot: HashMap<EncodedKey, EncodedValues>)
pub fn restore(&mut self, snapshot: HashMap<EncodedKey, EncodedValues>)
Restore from a snapshot
Sourcepub fn assert_value(
&self,
key: &EncodedKey,
expected: &[Value],
layout: &EncodedValuesLayout,
)
pub fn assert_value( &self, key: &EncodedKey, expected: &[Value], layout: &EncodedValuesLayout, )
Assert that a key has a specific value
Sourcepub fn assert_exists(&self, key: &EncodedKey)
pub fn assert_exists(&self, key: &EncodedKey)
Assert that a key exists
Sourcepub fn assert_not_exists(&self, key: &EncodedKey)
pub fn assert_not_exists(&self, key: &EncodedKey)
Assert that a key does not exist
Sourcepub fn assert_count(&self, expected: usize)
pub fn assert_count(&self, expected: usize)
Assert the state has a specific number of entries
Trait Implementations§
Source§impl Assertable for TestStateStore
impl Assertable for TestStateStore
type Assertion<'a> = StateAssertion<'a> where Self: 'a
fn assert(&self) -> StateAssertion<'_>
Source§impl Clone for TestStateStore
impl Clone for TestStateStore
Source§fn clone(&self) -> TestStateStore
fn clone(&self) -> TestStateStore
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 moreSource§impl Debug for TestStateStore
impl Debug for TestStateStore
Source§impl Default for TestStateStore
impl Default for TestStateStore
Source§fn default() -> TestStateStore
fn default() -> TestStateStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TestStateStore
impl RefUnwindSafe for TestStateStore
impl Send for TestStateStore
impl Sync for TestStateStore
impl Unpin for TestStateStore
impl UnwindSafe for TestStateStore
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