Use lossy converter

This commit is contained in:
Cappy Ishihara 2024-06-02 01:12:17 +07:00
parent 4e63f7ce7a
commit 6e5add39ac
No known key found for this signature in database
GPG key ID: 50862C285CB76906

View file

@ -18,7 +18,7 @@ pub fn rand() -> [u8; 50] {
//? What is this guy doing //? What is this guy doing
pub fn bytes_into_string(code: &[u8]) -> String { pub fn bytes_into_string(code: &[u8]) -> String {
// code.iter().map(|byte| format!("{:02x}", byte)).collect::<String>() // ????? Why do you need this? Why not just String::from_utf8()?? // code.iter().map(|byte| format!("{:02x}", byte)).collect::<String>() // ????? Why do you need this? Why not just String::from_utf8()??
String::from_utf8(code.to_vec()).unwrap() // Unwrap might be unsafe here... String::from_utf8_lossy(code).to_string()
} }
// Конец кор функций // Конец кор функций