Libraries
Articles in Section
- Anyhow Error Handler
Anyhow error-handling library
- clap CLI
Clap CLI library
- Command CLI
CLI Stdin / Stderr commands
- itertools
Itertools library
- rand
Random numbers library
- regex
Regular Expressions library
- serde
Serialization / Deserialization Library
- sysinfo
System Information Library
- Tokio tracing
Observability in Rust with Tokio tracing lib and OpenTelemetry
Library Unit-tests
ΠΡΠΈΠΌΠ΅ΡΡ:
pub fn greet_user(name: &str) -> String {
format!("Hello {name}")
}
pub fn login(username: &str, password: &str) -> bool {
username == "admin" && password == "P@ssw0rd"
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_greet_user() {
assert_eq!("Hello Alex", greet_user("Alex"));
}
#[test]
fn test_login() {
assert!(login("admin", "P@ssw0rd"));
}
}
ΠΠ°ΠΏΡΡΠΊ ΡΠ΅ΡΡΠΎΠ² - ΠΊΠΎΠΌΠ°Π½Π΄ΠΎΠΉ cargo test