♻️ Convierte initialize() y Application en async
`async_trait` se re-exporta desde `pagetop` y se añade al preludio; ya no es necesario declararlo como dependencia en las extensiones. `initialize()` es ahora verdaderamente `async` (con `.await`), y `Application::new()` y `prepare()` pasan también a ser funciones `async`.
This commit is contained in:
parent
54d5b3e53d
commit
8aa4372bdf
16 changed files with 159 additions and 107 deletions
|
|
@ -5,6 +5,7 @@ include_locales!(LOC from "examples/locale");
|
|||
|
||||
struct SuperMenu;
|
||||
|
||||
#[async_trait]
|
||||
impl Extension for SuperMenu {
|
||||
fn dependencies(&self) -> Vec<ExtensionRef> {
|
||||
vec![
|
||||
|
|
@ -14,7 +15,7 @@ impl Extension for SuperMenu {
|
|||
]
|
||||
}
|
||||
|
||||
fn initialize(&self) {
|
||||
async fn initialize(&self) {
|
||||
let navbar_menu = bs::Navbar::brand_left(bs::navbar::Brand::new())
|
||||
.with_expand(token::BreakPoint::LG)
|
||||
.with_item(bs::navbar::Item::nav(
|
||||
|
|
@ -114,5 +115,5 @@ impl Extension for SuperMenu {
|
|||
|
||||
#[pagetop::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
Application::prepare(&SuperMenu).run()?.await
|
||||
Application::prepare(&SuperMenu).await.run().await
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue