Trait TestEnv

Source
pub trait TestEnv: Sized {
    type Config: BlueprintConfig;
    type Context: Clone + Send + Sync + 'static;

    // Required methods
    fn new(
        config: Self::Config,
        env: BlueprintEnvironment,
    ) -> Result<Self, RunnerError>;
    fn add_job<J, T>(&mut self, job: J)
       where J: Job<T, Self::Context> + Send + Sync + 'static,
             T: 'static;
    fn add_background_service<B>(&mut self, service: B)
       where B: BackgroundService + Send + 'static;
    fn get_blueprint_config(&self) -> BlueprintEnvironment;
    fn run_runner(
        &mut self,
        context: Self::Context,
    ) -> impl Future<Output = Result<(), RunnerError>> + Send;
}

Required Associated Types§

Required Methods§

Source

fn new( config: Self::Config, env: BlueprintEnvironment, ) -> Result<Self, RunnerError>

Create a new test environment

§Errors

Errors depend on the implementation.

Source

fn add_job<J, T>(&mut self, job: J)
where J: Job<T, Self::Context> + Send + Sync + 'static, T: 'static,

Source

fn add_background_service<B>(&mut self, service: B)
where B: BackgroundService + Send + 'static,

Source

fn get_blueprint_config(&self) -> BlueprintEnvironment

Source

fn run_runner( &mut self, context: Self::Context, ) -> impl Future<Output = Result<(), RunnerError>> + Send

Start the runner

§Panics

Will panic if the runner is already started

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§