use std::borrow::Cow;
#[derive(Debug)]
pub enum Compression {
None,
Zstd,
}
#[derive(Debug)]
pub struct TestFile {
pub name: &'static str,
pub compression: Compression,
pub hash: &'static str,
}
impl TestFile {
pub const fn new(name: &'static str, compression: Compression, hash: &'static str) -> Self {
Self {
name,
compression,
hash,
}
}
pub const fn none(name: &'static str, hash: &'static str) -> Self {
Self::new(name, Compression::None, hash)
}
pub const fn zstd(name: &'static str, hash: &'static str) -> Self {
Self::new(name, Compression::Zstd, hash)
}
pub fn real_file_name(&self) -> Cow<'static, str> {
match self.compression {
Compression::None => Cow::Borrowed(self.name),
Compression::Zstd => Cow::Owned(format!("{}.zst", self.name)),
}
}
}