use crate::spec::types::ParityFailure;
use std::fs;
use std::io::{self, Write};
use std::path::PathBuf;
use std::sync::atomic::{AtomicU64, Ordering};
use std::time::{SystemTime, UNIX_EPOCH};
#[cfg(loom)]
use loom::sync::Mutex as LoomMutex;
use super::hex::*;
pub(super) fn sanitize(value: &str) -> String {
let mut out = String::with_capacity(value.len());
for byte in value.bytes() {
if byte.is_ascii_alphanumeric() || byte == b'-' || byte == b'_' {
out.push(byte as char);
} else {
out.push('%');
out.push(nibble(byte >> 4).to_ascii_uppercase());
out.push(nibble(byte & 0x0F).to_ascii_uppercase());
}
}
out
}