Trait TestView

Source
pub trait TestView: RootView<Context = MemoryContext<()>> + ClonableView {
    type State: Debug + Eq + Send;

    // Required methods
    async fn stage_initial_changes(&mut self) -> Result<Self::State, ViewError>;
    async fn stage_changes_to_be_discarded(
        &mut self,
    ) -> Result<Self::State, ViewError>;
    async fn stage_changes_to_be_persisted(
        &mut self,
    ) -> Result<Self::State, ViewError>;
    async fn read(&self) -> Result<Self::State, ViewError>;
}
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

async fn stage_initial_changes(&mut self) -> Result<Self::State, ViewError>

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

Source

async fn stage_changes_to_be_discarded( &mut self, ) -> Result<Self::State, ViewError>

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

async fn stage_changes_to_be_persisted( &mut self, ) -> Result<Self::State, ViewError>

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

async fn read(&self) -> Result<Self::State, ViewError>

Reads the view’s current state.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§