fixed some weired panic when accessing an element of a vec in an async

function.
- also cargo update
This commit is contained in:
Sebastian Moser
2022-10-09 12:55:14 +02:00
parent eeb9bbe694
commit f18667b5b3
7 changed files with 493 additions and 202 deletions

View File

@@ -145,12 +145,14 @@ impl Itemstore {
Err(e) => panic!("Error while querying the db: {}", e),
};
println!("ID: {}", id);
for key in keys {
let mut field: [Vec<u8>; 2] = [Vec::new(), Vec::new()];
field[0] = key.clone();
let mut ke = id.to_be_bytes().to_vec();
let mut ke = format!("{}", id).into_bytes();
ke.push(':' as u8);
ke.extend(key.clone());
println!("Key: {}", String::from_utf8(ke.clone()).unwrap());
field[1] = match tr.get(ke).await {
Ok(Some(val)) => val,
Ok(None) => panic!("a field that should be there wasn't"),