fix formatting, fixing users!!
This commit is contained in:
parent
793a8dcb7a
commit
847d8ea35c
2 changed files with 8 additions and 5 deletions
|
@ -34,5 +34,4 @@ _these features are implemented_
|
|||
|
||||
## todo
|
||||
|
||||
- fix gd not parsing the response from get_users correctly (sometimes has a hashtag in it? sometimes not? idfk)
|
||||
- move authorization logic to (./src/helpers/accounts.rs)[./src/helpers/accounts.rs]
|
|
@ -1,14 +1,18 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
pub fn format(map: HashMap<i32, impl ToString>) -> String {
|
||||
let mut sorted_keys: Vec<i32> = map.keys().copied().collect();
|
||||
sorted_keys.sort();
|
||||
|
||||
let mut result = String::new();
|
||||
|
||||
for (k, v) in map {
|
||||
result.push_str(&format!("{}:{}", k, v.to_string()));
|
||||
result.push(':');
|
||||
for key in sorted_keys {
|
||||
if let Some(val) = map.get(&key) {
|
||||
result.push_str(&format!("{}:{}:", key, val.to_string()));
|
||||
}
|
||||
}
|
||||
|
||||
if !result.is_empty() {
|
||||
if !result.ends_with(":") {
|
||||
result.pop();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue