Mountain/RPC/
configuration.rs1use std::collections::HashMap;
6
7use serde::{Deserialize, Serialize};
8
9pub struct ConfigurationService {
11 config:HashMap<String, serde_json::Value>,
12}
13
14impl ConfigurationService {
15 pub fn new() -> Self { Self { config:HashMap::new() } }
16
17 pub fn get(&self, key:&str) -> Option<&serde_json::Value> { self.config.get(key) }
18
19 pub fn set(&mut self, key:String, value:serde_json::Value) { self.config.insert(key, value); }
20}
21
22impl Default for ConfigurationService {
23 fn default() -> Self { Self::new() }
24}
25
26#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
28pub enum ConfigurationScope {
29 Global,
30 Workspace,
31 Folder,
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36pub struct ConfigurationUpdate {
37 pub key:String,
38 pub value:serde_json::Value,
39 pub scope:ConfigurationScope,
40}