add some formatting shit
This commit is contained in:
parent
4358ec6483
commit
80c884f489
4 changed files with 25 additions and 0 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -408,6 +408,7 @@ version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"diesel",
|
"diesel",
|
||||||
"dotenvy",
|
"dotenvy",
|
||||||
|
"maplit",
|
||||||
"password-auth",
|
"password-auth",
|
||||||
"regex",
|
"regex",
|
||||||
"rocket",
|
"rocket",
|
||||||
|
@ -655,6 +656,12 @@ dependencies = [
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "maplit"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "matchers"
|
name = "matchers"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
|
@ -6,6 +6,7 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
diesel = { version = "=2.1.0", features = ["postgres"] }
|
diesel = { version = "=2.1.0", features = ["postgres"] }
|
||||||
dotenvy = "0.15.7"
|
dotenvy = "0.15.7"
|
||||||
|
maplit = "1.0.2"
|
||||||
password-auth = "0.3.0"
|
password-auth = "0.3.0"
|
||||||
regex = "1.9.4"
|
regex = "1.9.4"
|
||||||
rocket = "=0.5.0-rc.3"
|
rocket = "=0.5.0-rc.3"
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
pub mod accounts;
|
pub mod accounts;
|
||||||
pub mod clean;
|
pub mod clean;
|
||||||
|
pub mod format;
|
||||||
pub mod gjp2;
|
pub mod gjp2;
|
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