use Version;
const MAJOR: u8 = 1;
pub trait Feature {
fn is_supported_by(version: Version) -> bool;
fn name() -> &'static str;
}
macro_rules! features {
( $(
$(#[$meta:meta])*
$name:ident ($($versions:expr),+);
)+
) => {
$(
$(#[$meta])*
#[derive(Clone, Copy, Debug)]
pub struct $name {}
impl Feature for $name {
fn is_supported_by(version: Version) -> bool {
vec![$($versions),+]
.into_iter()
.map(|minor| Version::new(MAJOR, minor))
.any(|v| version == v)
}
fn name() -> &'static str {
stringify!($name)
}
}
)+
}
}
features! {
FileSourceId(1, 2, 3, 4);
GpsStandardTime(2, 3, 4);
Waveforms(3, 4);
SyntheticReturnNumbers(3, 4);
LargeFiles(4);
Evlrs(4);
}