Compare commits

..

No commits in common. "bc03fd73a0010c46f379e5d3b510b415bc4273b4" and "f7d7c7307308b49175a342a7c63dc0a5044f0fb5" have entirely different histories.

3 changed files with 39 additions and 19 deletions

40
Cargo.lock generated
View file

@ -113,22 +113,25 @@ checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
[[package]] [[package]]
name = "criterion" name = "criterion"
version = "0.6.0" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bf7af66b0989381bd0be551bd7cc91912a655a58c6918420c9527b1fd8b4679" checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f"
dependencies = [ dependencies = [
"anes", "anes",
"cast", "cast",
"ciborium", "ciborium",
"clap", "clap",
"criterion-plot", "criterion-plot",
"itertools 0.13.0", "is-terminal",
"itertools",
"num-traits", "num-traits",
"once_cell",
"oorandom", "oorandom",
"plotters", "plotters",
"rayon", "rayon",
"regex", "regex",
"serde", "serde",
"serde_derive",
"serde_json", "serde_json",
"tinytemplate", "tinytemplate",
"walkdir", "walkdir",
@ -141,7 +144,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1"
dependencies = [ dependencies = [
"cast", "cast",
"itertools 0.10.5", "itertools",
] ]
[[package]] [[package]]
@ -192,19 +195,27 @@ dependencies = [
] ]
[[package]] [[package]]
name = "itertools" name = "hermit-abi"
version = "0.10.5" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" checksum = "fbd780fe5cc30f81464441920d82ac8740e2e46b29a6fad543ddd075229ce37e"
[[package]]
name = "is-terminal"
version = "0.4.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9"
dependencies = [ dependencies = [
"either", "hermit-abi",
"libc",
"windows-sys",
] ]
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.13.0" version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
dependencies = [ dependencies = [
"either", "either",
] ]
@ -225,6 +236,12 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "lazy_static"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.171" version = "0.2.171"
@ -245,9 +262,10 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]] [[package]]
name = "microfetch" name = "microfetch"
version = "0.4.9" version = "0.4.8"
dependencies = [ dependencies = [
"criterion", "criterion",
"lazy_static",
"libc", "libc",
"nix", "nix",
] ]

View file

@ -1,6 +1,6 @@
[package] [package]
name = "microfetch" name = "microfetch"
version = "0.4.9" version = "0.4.8"
edition = "2024" edition = "2024"
[lib] [lib]
@ -13,10 +13,11 @@ path = "src/main.rs"
[dependencies] [dependencies]
nix = { version = "0.30", features = ["fs", "hostname", "feature"] } nix = { version = "0.30", features = ["fs", "hostname", "feature"] }
lazy_static = "1.5"
libc = "0.2" libc = "0.2"
[dev-dependencies] [dev-dependencies]
criterion = "0.6" criterion = "0.5"
[[bench]] [[bench]]
name = "benchmark" name = "benchmark"

View file

@ -1,5 +1,4 @@
use std::env; use std::env;
use std::sync::LazyLock;
pub struct Colors { pub struct Colors {
pub reset: &'static str, pub reset: &'static str,
@ -37,11 +36,13 @@ impl Colors {
} }
} }
pub static COLORS: LazyLock<Colors> = LazyLock::new(|| { lazy_static::lazy_static! {
pub static ref COLORS: Colors = {
// check for NO_COLOR once at startup // check for NO_COLOR once at startup
let is_no_color = env::var("NO_COLOR").is_ok(); let is_no_color = env::var("NO_COLOR").is_ok();
Colors::new(is_no_color) Colors::new(is_no_color)
}); };
}
pub fn print_dots() -> String { pub fn print_dots() -> String {
format!( format!(