Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
caibear committed Mar 15, 2024
1 parent 561b065 commit 7fea486
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,12 @@ pub fn bench_size(name: &str, lib: &str, bytes: &[u8]) {
println!("{}/{}/size {}", name, lib, bytes.len());
println!("{}/{}/zlib {}", name, lib, zlib_size(bytes));
println!("{}/{}/zstd {}", name, lib, zstd_size(bytes));
println!("{}/{}/zstd_time {}", name, lib, bench_compression(|| zstd_size(bytes)));
println!(
"{}/{}/zstd_time {}",
name,
lib,
bench_compression(|| zstd_size(bytes))
);
}

fn bench_compression(compress: impl Fn() -> usize) -> String {
Expand Down
26 changes: 18 additions & 8 deletions tools/formatter/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,16 @@ fn write_crate_row(output: &mut String, feature: &str, features: &Features) -> f
}

pub fn capitalize(s: &str) -> String {
s.split("_").map(|s| {
let mut c = s.chars();
match c.next() {
None => String::new(),
Some(f) => f.to_uppercase().collect::<String>() + c.as_str(),
}
}).collect::<Vec<_>>().join(" ")
s.split("_")
.map(|s| {
let mut c = s.chars();
match c.next() {
None => String::new(),
Some(f) => f.to_uppercase().collect::<String>() + c.as_str(),
}
})
.collect::<Vec<_>>()
.join(" ")
}

fn build_tables(
Expand Down Expand Up @@ -191,7 +194,14 @@ fn format(
template: &str,
date: &str,
) -> Result<String, fmt::Error> {
const SERDE_COLS: &[&str] = &["serialize", "deserialize", "size", "zlib", "zstd", "zstd_time"];
const SERDE_COLS: &[&str] = &[
"serialize",
"deserialize",
"size",
"zlib",
"zstd",
"zstd_time",
];
const ZCD_COLS: &[&str] = &["access", "read", "update"];

let mut tables = String::new();
Expand Down

0 comments on commit 7fea486

Please sign in to comment.