pub trait AppModule:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &'static str;
fn schema(&self) -> SchemaSet;
fn init(&self, context: &mut ModuleContext);
// Provided methods
fn migrations(&self) -> Vec<Migration> { ... }
fn migration_path(&self) -> Option<&'static str> { ... }
fn sync_registry(&self) -> Option<Registry> { ... }
fn schema_objects(&self) -> Vec<SchemaObjectState> { ... }
fn subscribe(&self, _state: &AppState) { ... }
fn start(&self, _state: &AppState) { ... }
fn middleware(&self, router: Router, _state: &AppState) -> Router { ... }
fn openapi(&self, _state: &AppState) -> Value { ... }
}Required Methods§
fn name(&self) -> &'static str
fn schema(&self) -> SchemaSet
fn init(&self, context: &mut ModuleContext)
Provided Methods§
Sourcefn migrations(&self) -> Vec<Migration>
fn migrations(&self) -> Vec<Migration>
Compiled migrations owned by this application, including portable project modules. Legacy project registries may still be passed to Management.
Sourcefn migration_path(&self) -> Option<&'static str>
fn migration_path(&self) -> Option<&'static str>
Writable source directory for makemigrations. None denotes a library application whose migration sources are not managed by this project.
Sourcefn sync_registry(&self) -> Option<Registry>
fn sync_registry(&self) -> Option<Registry>
Register server synchronization tables in the desired migration state. Several modules may expose their registries; shared server metadata tables are included once per database.
Sourcefn schema_objects(&self) -> Vec<SchemaObjectState>
fn schema_objects(&self) -> Vec<SchemaObjectState>
Triggers and views owned by this application. Their app field is
assigned from Self::name while collecting migration state.
fn subscribe(&self, _state: &AppState)
fn start(&self, _state: &AppState)
fn middleware(&self, router: Router, _state: &AppState) -> Router
fn openapi(&self, _state: &AppState) -> Value
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".