Format rust files

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
Lee Smet
2025-08-25 11:16:25 +02:00
parent e9675aafed
commit ff0659b933
25 changed files with 2267 additions and 1318 deletions

View File

@@ -1,12 +1,15 @@
use herodb::protocol::Protocol;
use herodb::cmd::Cmd;
use herodb::protocol::Protocol;
#[test]
fn test_protocol_parsing() {
// Test TYPE command parsing
let type_cmd = "*2\r\n$4\r\nTYPE\r\n$7\r\nnoexist\r\n";
println!("Parsing TYPE command: {}", type_cmd.replace("\r\n", "\\r\\n"));
println!(
"Parsing TYPE command: {}",
type_cmd.replace("\r\n", "\\r\\n")
);
match Protocol::from(type_cmd) {
Ok((protocol, _)) => {
println!("Protocol parsed successfully: {:?}", protocol);
@@ -17,11 +20,14 @@ fn test_protocol_parsing() {
}
Err(e) => println!("Protocol parsing failed: {:?}", e),
}
// Test HEXISTS command parsing
let hexists_cmd = "*3\r\n$7\r\nHEXISTS\r\n$4\r\nhash\r\n$7\r\nnoexist\r\n";
println!("\nParsing HEXISTS command: {}", hexists_cmd.replace("\r\n", "\\r\\n"));
println!(
"\nParsing HEXISTS command: {}",
hexists_cmd.replace("\r\n", "\\r\\n")
);
match Protocol::from(hexists_cmd) {
Ok((protocol, _)) => {
println!("Protocol parsed successfully: {:?}", protocol);
@@ -32,4 +38,4 @@ fn test_protocol_parsing() {
}
Err(e) => println!("Protocol parsing failed: {:?}", e),
}
}
}