add async_trait support for UpnpApiExt trait and impl

- Add `async-trait` dependency import
- Annotate UpnpApiExt trait and its Server impl with `#[async_trait]` to enable async methods in traits
This commit is contained in:
2026-04-04 00:22:58 +02:00
parent 5a9e156566
commit 54ea7b5813

View File

@@ -17,6 +17,7 @@ use axum::{
response::{IntoResponse, Json}, response::{IntoResponse, Json},
routing::get, routing::get,
}; };
use async_trait::async_trait;
use pmoserver::Server; use pmoserver::Server;
use serde_json::json; use serde_json::json;
use tracing::info; use tracing::info;
@@ -218,6 +219,7 @@ async fn get_service_variables(
/// Trait d'extension pour enregistrer l'API UPnP sur un serveur. /// Trait d'extension pour enregistrer l'API UPnP sur un serveur.
/// ///
/// Similaire à `WebAppExt` et `CoverCacheExt`. /// Similaire à `WebAppExt` et `CoverCacheExt`.
#[async_trait]
pub trait UpnpApiExt { pub trait UpnpApiExt {
/// Enregistre l'API REST d'introspection UPnP. /// Enregistre l'API REST d'introspection UPnP.
/// ///
@@ -229,6 +231,7 @@ pub trait UpnpApiExt {
async fn register_upnp_api(&mut self); async fn register_upnp_api(&mut self);
} }
#[async_trait]
impl UpnpApiExt for Server { impl UpnpApiExt for Server {
async fn register_upnp_api(&mut self) { async fn register_upnp_api(&mut self) {
info!("📡 Registering UPnP introspection API..."); info!("📡 Registering UPnP introspection API...");