caldir_core/remote/config/
params.rs1use std::collections::BTreeMap;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
6pub struct RemoteConfigParams(BTreeMap<String, toml::Value>); impl RemoteConfigParams {
9 pub fn new() -> Self {
10 Self(BTreeMap::new())
11 }
12
13 pub fn get(&self, key: &str) -> Option<&toml::Value> {
14 self.0.get(key)
15 }
16
17 pub fn is_empty(&self) -> bool {
18 self.0.is_empty()
19 }
20
21 pub fn insert(&mut self, key: String, value: toml::Value) {
22 self.0.insert(key, value);
23 }
24}
25
26impl From<BTreeMap<String, toml::Value>> for RemoteConfigParams {
27 fn from(map: BTreeMap<String, toml::Value>) -> Self {
28 Self(map)
29 }
30}