Skip to main content

App

Trait App 

Source
pub trait App<S>:
    Send
    + Sync
    + Sized
where S: Clone + Send + Sync + 'static, AppContext: FromRef<S>,
{ type Cli: Args + RunCommand<Self, S> + Send + Sync;
Show 18 methods // Required method fn provide_state<'life0, 'async_trait>( &'life0 self, context: AppContext, ) -> Pin<Box<dyn Future<Output = RoadsterResult<S>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn async_config_sources( &self, _environment: &Environment, ) -> RoadsterResult<Vec<Box<dyn AsyncSource + Send + Sync>>> { ... } fn init_tracing(&self, config: &AppConfig) -> RoadsterResult<()> { ... } fn metadata(&self, _config: &AppConfig) -> RoadsterResult<AppMetadata> { ... } fn provide_context_extensions<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _config: &'life1 AppConfig, _extension_registry: &'life2 mut ExtensionRegistry, ) -> Pin<Box<dyn Future<Output = RoadsterResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn sea_orm_connection_options( &self, config: &AppConfig, ) -> RoadsterResult<ConnectOptions> { ... } fn diesel_connection_customizer<C>( &self, _config: &AppConfig, ) -> RoadsterResult<Option<Box<dyn CustomizeConnection<C, Error>>>> where C: 'static + Connection + R2D2Connection { ... } fn diesel_pg_connection_customizer( &self, _config: &AppConfig, ) -> RoadsterResult<Box<dyn CustomizeConnection<DieselPgConn, Error>>> { ... } fn diesel_mysql_connection_customizer( &self, _config: &AppConfig, ) -> RoadsterResult<Box<dyn CustomizeConnection<DieselMysqlConn, Error>>> { ... } fn diesel_sqlite_connection_customizer( &self, _config: &AppConfig, ) -> RoadsterResult<Box<dyn CustomizeConnection<DieselSqliteConn, Error>>> { ... } fn diesel_pg_async_connection_customizer( &self, _config: &AppConfig, ) -> RoadsterResult<Box<dyn CustomizeConnection<DieselPgConnAsync, PoolError>>> { ... } fn diesel_mysql_async_connection_customizer( &self, _config: &AppConfig, ) -> RoadsterResult<Box<dyn CustomizeConnection<DieselMysqlConnAsync, PoolError>>> { ... } fn worker_pg_sqlx_pool_options( &self, config: &AppConfig, ) -> RoadsterResult<PoolOptions<Postgres>> { ... } fn migrators(&self, _state: &S) -> RoadsterResult<Vec<Box<dyn Migrator<S>>>> { ... } fn lifecycle_handlers<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _registry: &'life1 mut LifecycleHandlerRegistry<Self, S>, _state: &'life2 S, ) -> Pin<Box<dyn Future<Output = RoadsterResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn health_checks<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _registry: &'life1 mut HealthCheckRegistry, _state: &'life2 S, ) -> Pin<Box<dyn Future<Output = RoadsterResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn services<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _registry: &'life1 mut ServiceRegistry<S>, _state: &'life2 S, ) -> Pin<Box<dyn Future<Output = RoadsterResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn graceful_shutdown_signal<'life0, 'async_trait>( self: Arc<Self>, _state: &'life0 S, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... }
}

Required Associated Types§

Source

type Cli: Args + RunCommand<Self, S> + Send + Sync

Required Methods§

Source

fn provide_state<'life0, 'async_trait>( &'life0 self, context: AppContext, ) -> Pin<Box<dyn Future<Output = RoadsterResult<S>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provide the app state that will be used throughout the app. The state can simply be the provided AppContext, or a custom type that implements FromRef to allow Roadster to extract its AppContext when needed.

See the following for more details regarding FromRef: https://docs.rs/axum/0.7.5/axum/extract/trait.FromRef.html

Provided Methods§

Source

fn async_config_sources( &self, _environment: &Environment, ) -> RoadsterResult<Vec<Box<dyn AsyncSource + Send + Sync>>>

Source

fn init_tracing(&self, config: &AppConfig) -> RoadsterResult<()>

Source

fn metadata(&self, _config: &AppConfig) -> RoadsterResult<AppMetadata>

Source

fn provide_context_extensions<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _config: &'life1 AppConfig, _extension_registry: &'life2 mut ExtensionRegistry, ) -> Pin<Box<dyn Future<Output = RoadsterResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn sea_orm_connection_options( &self, config: &AppConfig, ) -> RoadsterResult<ConnectOptions>

Source

fn diesel_connection_customizer<C>( &self, _config: &AppConfig, ) -> RoadsterResult<Option<Box<dyn CustomizeConnection<C, Error>>>>
where C: 'static + Connection + R2D2Connection,

Source

fn diesel_pg_connection_customizer( &self, _config: &AppConfig, ) -> RoadsterResult<Box<dyn CustomizeConnection<DieselPgConn, Error>>>

Source

fn diesel_mysql_connection_customizer( &self, _config: &AppConfig, ) -> RoadsterResult<Box<dyn CustomizeConnection<DieselMysqlConn, Error>>>

Source

fn diesel_sqlite_connection_customizer( &self, _config: &AppConfig, ) -> RoadsterResult<Box<dyn CustomizeConnection<DieselSqliteConn, Error>>>

Source

fn diesel_pg_async_connection_customizer( &self, _config: &AppConfig, ) -> RoadsterResult<Box<dyn CustomizeConnection<DieselPgConnAsync, PoolError>>>

Source

fn diesel_mysql_async_connection_customizer( &self, _config: &AppConfig, ) -> RoadsterResult<Box<dyn CustomizeConnection<DieselMysqlConnAsync, PoolError>>>

Source

fn worker_pg_sqlx_pool_options( &self, config: &AppConfig, ) -> RoadsterResult<PoolOptions<Postgres>>

Allows customizing the pool options used for the sqlx Postgres connection used for pgmq.

Source

fn migrators(&self, _state: &S) -> RoadsterResult<Vec<Box<dyn Migrator<S>>>>

Note: SeaORM and Diesel migrations expect all of the applied migrations to be available to the provided migrator, so multiple SeaORM or Diesel migrators should not be provided via this method.

Source

fn lifecycle_handlers<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _registry: &'life1 mut LifecycleHandlerRegistry<Self, S>, _state: &'life2 S, ) -> Pin<Box<dyn Future<Output = RoadsterResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn health_checks<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _registry: &'life1 mut HealthCheckRegistry, _state: &'life2 S, ) -> Pin<Box<dyn Future<Output = RoadsterResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Provide the crate::health::check::HealthChecks to use throughout the app.

Source

fn services<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _registry: &'life1 mut ServiceRegistry<S>, _state: &'life2 S, ) -> Pin<Box<dyn Future<Output = RoadsterResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Provide the crate::service::Services to run in the app.

Source

fn graceful_shutdown_signal<'life0, 'async_trait>( self: Arc<Self>, _state: &'life0 S, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Override to provide a custom shutdown signal. Roadster provides some default shutdown signals, but it may be desirable to provide a custom signal in order to, e.g., shutdown the server when a particular API is called.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<S, Cli: 'static + Args + RunCommand<RoadsterApp<S, Cli>, S> + Send + Sync> App<S> for RoadsterApp<S, Cli>
where S: Clone + Send + Sync + 'static, AppContext: FromRef<S>,

Source§

type Cli = Cli