arq 0.1.4

Arq library to manage Arq Backup data formats
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/// Converts an array of u8 into a string of hex.
pub fn convert_to_hex_string(array: &[u8]) -> String {
    array.iter().map(|a| format!("{:02x}", a)).collect()
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_convert_to_hex_string() {
        let data = vec![12, 34, 11, 56, 78, 92];
        assert_eq!(convert_to_hex_string(&data), "0c220b384e5c");
        assert_eq!(convert_to_hex_string(&[]), "");
    }
}