router: AsAny: add as_any_mut

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2024-06-13 14:13:07 +02:00
parent f78c28dd11
commit 41b08323a7

View File

@ -5,12 +5,17 @@ use serde_json::Value;
/// Helper to get around `RpcEnvironment: Sized`
pub trait AsAny {
fn as_any(&self) -> &(dyn Any + Send);
fn as_any_mut(&mut self) -> &mut (dyn Any + Send);
}
impl<T: Any + Send> AsAny for T {
fn as_any(&self) -> &(dyn Any + Send) {
self
}
fn as_any_mut(&mut self) -> &mut (dyn Any + Send) {
self
}
}
/// Abstract Interface for API methods to interact with the environment