mirror of
http://shenjack.top:5100/shenjack/icalingua-python-bot.git
synced 2025-04-20 05:39:54 +08:00
fmt
This commit is contained in:
parent
ad66657d37
commit
9e72c8a117
|
@ -48,27 +48,28 @@ impl ConfigStoragePy {
|
||||||
match kwargs {
|
match kwargs {
|
||||||
Some(kwargs) => {
|
Some(kwargs) => {
|
||||||
let mut keys = HashMap::new();
|
let mut keys = HashMap::new();
|
||||||
for (key, value) in kwargs.iter() {
|
for (key, value) in kwargs.iter() {}
|
||||||
|
|
||||||
}
|
|
||||||
Ok(Self { keys })
|
Ok(Self { keys })
|
||||||
}
|
}
|
||||||
None => Ok(Self { keys: HashMap::new() }),
|
None => Ok(Self {
|
||||||
|
keys: HashMap::new(),
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[getter]
|
#[getter]
|
||||||
/// 获取最大允许的层级深度
|
/// 获取最大允许的层级深度
|
||||||
pub fn get_max_allowed_depth(&self) -> usize {
|
pub fn get_max_allowed_depth(&self) -> usize { MAX_CFG_DEPTH }
|
||||||
MAX_CFG_DEPTH
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConfigStoragePy {
|
impl ConfigStoragePy {
|
||||||
/// 递归解析配置
|
/// 递归解析配置
|
||||||
///
|
///
|
||||||
/// 用个 Result 来标记递归过深
|
/// 用个 Result 来标记递归过深
|
||||||
fn parse_init_key(map: &mut HashMap<String, ConfigItemPy>, current_deepth: usize) -> Result<(), usize>{
|
fn parse_init_key(
|
||||||
|
map: &mut HashMap<String, ConfigItemPy>,
|
||||||
|
current_deepth: usize,
|
||||||
|
) -> Result<(), usize> {
|
||||||
if current_deepth > MAX_CFG_DEPTH {
|
if current_deepth > MAX_CFG_DEPTH {
|
||||||
Err(current_deepth)
|
Err(current_deepth)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user