Building a library around axum
⚓ Rust 📅 2026-01-22 👤 surdeus 👁️ 2For my CMS/Webapp framework project I'm using axum to handle the requests and responses. I have a App struct to contain the application state and some logic and a Plugin trait:
struct MyPlugin;
impl Plugin for MyPlugin {
fn initialize(&self, app: App) {
// do things like add routes
}
}
// register it to be run on startup
app.register_plugin(MyPlugin);
With this there are two main problems I need to solve:
- There are two approaches to state: using Router.with_state and Extension. Is using Extension the better method?
- Allowing use of the Router: its methods being self-consuming is tricky, would it be best to provide methods in App and then build it after plugins are run?
1 post - 1 participant
🏷️ Rust_feed