dev: reduce build sizes (especially debug)
This commit is contained in:
11
Cargo.toml
11
Cargo.toml
@@ -10,8 +10,19 @@ keywords = ["oauth", "oauth2", "oidc", "OpenID"]
|
||||
categories = ["web-programming::http-server", "authentication"]
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
strip = "symbols" # almost half of binary size smh
|
||||
|
||||
# so I don't need "full" just yet and the debug builds are HUGE
|
||||
[profile.dev]
|
||||
debug = 1
|
||||
[profile.dev.package.actix-web]
|
||||
opt-level = 3
|
||||
debug = false
|
||||
[profile.dev.package.tokio]
|
||||
opt-level = 3
|
||||
debug = false
|
||||
|
||||
[features]
|
||||
default = ["pamsock"]
|
||||
pamsock = ["dep:pamsock"]
|
||||
|
||||
26
src/utils.rs
26
src/utils.rs
@@ -37,3 +37,29 @@ pub mod web {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod shasum {
|
||||
#[must_use]
|
||||
pub fn sha256sum_to_hex_string(sha256sum: &[u8]) -> String {
|
||||
let mut out = String::with_capacity(sha256sum.len() * 2);
|
||||
|
||||
for &b in sha256sum {
|
||||
/// Only correct as long as `n` is ranged within a nibble
|
||||
#[inline]
|
||||
const fn nibble_to_hex(n: u8) -> char {
|
||||
(match n {
|
||||
0..=9 => b'0' + n,
|
||||
_ => b'a' + (n - 10),
|
||||
}) as char
|
||||
}
|
||||
|
||||
let hi = (b >> 4) & 0x0f;
|
||||
let lo = b & 0x0f;
|
||||
|
||||
out.push(nibble_to_hex(hi));
|
||||
out.push(nibble_to_hex(lo));
|
||||
}
|
||||
|
||||
out
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user