forked from torrust/torrust-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.rs
More file actions
30 lines (27 loc) · 700 Bytes
/
lib.rs
File metadata and controls
30 lines (27 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
pub mod counter;
pub mod gauge;
pub mod label;
pub mod metric;
pub mod metric_collection;
pub mod prometheus;
pub mod sample;
pub mod sample_collection;
pub mod unit;
pub const METRICS_TARGET: &str = "METRICS";
#[cfg(test)]
mod tests {
/// It removes leading and trailing whitespace from each line.
pub fn format_prometheus_output(output: &str) -> String {
output
.lines()
.map(str::trim_start)
.map(str::trim_end)
.collect::<Vec<_>>()
.join("\n")
}
pub fn sort_lines(s: &str) -> String {
let mut lines: Vec<&str> = s.split('\n').collect();
lines.sort_unstable();
lines.join("\n")
}
}