add some formatting shit
This commit is contained in:
parent
4358ec6483
commit
80c884f489
4 changed files with 25 additions and 0 deletions
16
src/helpers/format.rs
Normal file
16
src/helpers/format.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
pub fn format(map: HashMap<i32, impl ToString>) -> String {
|
||||
let mut result = String::new();
|
||||
|
||||
for (k, v) in map {
|
||||
result.push_str(&format!("{}:{}", k, v.to_string()));
|
||||
result.push(':');
|
||||
}
|
||||
|
||||
if !result.is_empty() {
|
||||
result.pop();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue