Trait linera_views::test_utils::test_views::TestView

source ·
pub trait TestView: RootView<MemoryContext<()>> + ClonableView<MemoryContext<()>> + Send + Sync + 'static {
    type State: Debug + Eq + Send;

    // Required methods
    fn stage_initial_changes<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::State, ViewError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stage_changes_to_be_discarded<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::State, ViewError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stage_changes_to_be_persisted<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::State, ViewError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn read<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::State, ViewError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A View to be used in test cases.

Required Associated Types§

source

type State: Debug + Eq + Send

Representation of the view’s state.

Required Methods§

source

fn stage_initial_changes<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Self::State, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Performs some initial changes to the view, staging them, and returning a representation of the view’s state.

source

fn stage_changes_to_be_discarded<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Self::State, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stages some changes to the view that won’t be persisted during the test.

Assumes that the current view state is the initially staged changes. Returns the updated state.

source

fn stage_changes_to_be_persisted<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Self::State, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stages some changes to the view that will be persisted during the test.

Assumes that the current view state is the initially staged changes. Returns the updated state.

source

fn read<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self::State, ViewError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reads the view’s current state.

Object Safety§

This trait is not object safe.

Implementors§