1#[cfg(feature = "async")]
4use crate::future::BoxFuture;
5#[cfg(test)]
6use mockall::automock;
7use springtime_di::injectable;
8pub use springtime_di::instance_provider::ErrorPtr;
9
10#[cfg(feature = "threadsafe")]
11pub type ApplicationRunnerPtr = dyn ApplicationRunner + Send + Sync;
12
13#[cfg(not(feature = "threadsafe"))]
14pub type ApplicationRunnerPtr = dyn ApplicationRunner;
15
16#[injectable]
20#[cfg_attr(test, automock)]
21pub trait ApplicationRunner {
22 #[cfg(feature = "async")]
23 fn run(&self) -> BoxFuture<'_, Result<(), ErrorPtr>>;
25
26 #[cfg(not(feature = "async"))]
27 fn run(&self) -> Result<(), ErrorPtr>;
29
30 fn priority(&self) -> i8 {
32 0
33 }
34}