refactor: improve type ergonomics

This commit is contained in:
Lucille L. Blumire 2025-04-17 16:03:42 +01:00
parent 0768b0ad67
commit 2ff169da9f
No known key found for this signature in database
GPG key ID: D168492023622329
11 changed files with 22 additions and 25 deletions

View file

@ -260,7 +260,7 @@ fn decode_tdx_mrs(
Some(mrs_array) => {
let result = mrs_array
.into_iter()
.map(|strings| decode_and_combine_mrs(strings, bytes_length))
.map(|strings| decode_and_combine_mrs(&strings, bytes_length))
.collect::<Result<Vec<_>, _>>()?;
Ok(Some(result))
}
@ -269,12 +269,12 @@ fn decode_tdx_mrs(
// Helper function to decode and combine MRs
fn decode_and_combine_mrs(
strings: [String; 5],
strings: &[String; 5],
bytes_length: usize,
) -> Result<Bytes, hex::FromHexError> {
let mut buffer = BytesMut::with_capacity(bytes_length * 5);
for s in &strings {
for s in strings {
if s.len() > (bytes_length * 2) {
return Err(hex::FromHexError::InvalidStringLength);
}