RpcEnvironment: add environment type enum RpcEnvironmentType

This commit is contained in:
Dietmar Maurer
2019-01-27 10:33:42 +01:00
parent e82dad9700
commit 162b979394
4 changed files with 28 additions and 3 deletions

View File

@ -4,12 +4,16 @@ use std::collections::HashMap;
use serde_json::Value;
pub struct RestEnvironment {
env_type: RpcEnvironmentType,
result_attributes: HashMap<String, Value>,
}
impl RestEnvironment {
pub fn new() -> Self {
Self { result_attributes: HashMap::new() }
pub fn new(env_type: RpcEnvironmentType) -> Self {
Self {
result_attributes: HashMap::new(),
env_type,
}
}
}
@ -22,4 +26,8 @@ impl RpcEnvironment for RestEnvironment {
fn get_result_attrib(&self, name: &str) -> Option<&Value> {
self.result_attributes.get(name)
}
fn env_type(&self) -> RpcEnvironmentType {
self.env_type
}
}