diff --git a/proxmox-api-macro/src/api_macro/function.rs b/proxmox-api-macro/src/api_macro/function.rs index 0f8a5eea..0e6a328e 100644 --- a/proxmox-api-macro/src/api_macro/function.rs +++ b/proxmox-api-macro/src/api_macro/function.rs @@ -347,7 +347,7 @@ pub fn handle_function( #struct_name::wrapped_api_handler(params) } - fn method_info(&self) -> &(dyn ::proxmox::api::ApiMethodInfo + Send + Sync) { + fn method_info(&self) -> &dyn ::proxmox::api::ApiMethodInfo { self as _ } } diff --git a/proxmox-api/src/api_type.rs b/proxmox-api/src/api_type.rs index 8599a6ff..48f5b6d4 100644 --- a/proxmox-api/src/api_type.rs +++ b/proxmox-api/src/api_type.rs @@ -9,7 +9,7 @@ use serde_json::{json, Value}; /// Method entries in a `Router` are actually just `&dyn ApiMethodInfo` trait objects. /// This contains all the info required to call, document, or command-line-complete parameters for /// a method. -pub trait ApiMethodInfo { +pub trait ApiMethodInfo: Send + Sync { fn description(&self) -> &'static str; fn parameters(&self) -> &'static [Parameter]; fn return_type(&self) -> &'static TypeInfo; @@ -17,11 +17,11 @@ pub trait ApiMethodInfo { fn reload_timezone(&self) -> bool; } -pub trait ApiHandler: ApiMethodInfo + Send + Sync { +pub trait ApiHandler: ApiMethodInfo { type Body; fn call(&self, params: Value) -> super::ApiFuture; - fn method_info(&self) -> &(dyn ApiMethodInfo + Send + Sync); + fn method_info(&self) -> &dyn ApiMethodInfo; } impl dyn ApiHandler { @@ -133,12 +133,12 @@ impl ApiHandler for ApiMethod { (self.handler)(params) } - fn method_info(&self) -> &(dyn ApiMethodInfo + Send + Sync) { + fn method_info(&self) -> &dyn ApiMethodInfo { self as _ } } -impl dyn ApiMethodInfo + Send + Sync { +impl dyn ApiMethodInfo { pub fn api_dump(&self) -> Value { let parameters = Value::Object(std::iter::FromIterator::from_iter( self.parameters()