Mountain/RPC/
configuration.rs

1//! # Configuration RPC Service
2//!
3//! Configuration management service for read/write operations.
4
5use std::collections::HashMap;
6
7use serde::{Deserialize, Serialize};
8
9/// Configuration service
10pub 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/// Configuration scope
27#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
28pub enum ConfigurationScope {
29	Global,
30	Workspace,
31	Folder,
32}
33
34/// Configuration update
35#[derive(Debug, Clone, Serialize, Deserialize)]
36pub struct ConfigurationUpdate {
37	pub key:String,
38	pub value:serde_json::Value,
39	pub scope:ConfigurationScope,
40}