router: fix impl Index for dyn RpcEnvironment

implement Index and IndexMut on `dyn RpcEnvironment` rather
than on a reference to it

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2022-04-21 13:45:25 +02:00
parent 47c9bed30d
commit 39956b5d09

View File

@ -57,6 +57,20 @@ pub enum RpcEnvironmentType {
PRIVILEGED,
}
impl core::ops::Index<&str> for dyn RpcEnvironment {
type Output = Value;
fn index(&self, index: &str) -> &Value {
self.result_attrib().index(index)
}
}
impl core::ops::IndexMut<&str> for dyn RpcEnvironment {
fn index_mut(&mut self, index: &str) -> &mut Value {
self.result_attrib_mut().index_mut(index)
}
}
// deprecated Index variants:
impl core::ops::Index<&str> for &dyn RpcEnvironment {
type Output = Value;
fn index(&self, index: &str) -> &Value {