versioned_feature_core/lib.rs
1pub type FeatureVersion = u16;
2pub type OptionalFeatureVersion = Option<u16>; //This is a feature that didn't always exist
3
4#[derive(Clone, Debug, Default)]
5pub struct FeatureVersionBounds {
6 pub min_version: FeatureVersion,
7 pub max_version: FeatureVersion,
8 pub default_current_version: FeatureVersion,
9}
10
11impl FeatureVersionBounds {
12 /// Will get a protocol error if the version is unknown
13 pub fn check_version(&self, version: FeatureVersion) -> bool {
14 version >= self.min_version && version <= self.max_version
15 }
16}