add conexion number control

This commit is contained in:
2022-09-24 14:26:07 +02:00
parent aeb69bab26
commit 230d5d1c82
6 changed files with 79 additions and 34 deletions

View File

@@ -11,8 +11,8 @@ pub struct Servers{
}
impl Servers {
pub fn new() -> Servers {
Servers{
pub fn new() -> Self {
Self{
l_servers: Self::get_servers(),
}
}
@@ -23,15 +23,13 @@ impl Servers {
let mut ret = HashMap::new();
f.read_to_string(&mut s).unwrap();
let docs = yaml::YamlLoader::load_from_str(&s).unwrap();
let docs2;
match &docs[0]["servers"] {
yaml::Yaml::Hash(ref h) => docs2 = h,
let docs2 = match &docs[0]["servers"] {
yaml::Yaml::Hash(ref h) => h,
_ => return ret,
}
};
for (k, v) in docs2{
//println!("{}",String::from(doc.as_str().unwrap()));
ret.insert(String::from(k.as_str().unwrap()),
String::from(v.as_str().unwrap()));
}