robotrt-data-model 0.1.0-beta.1

RobotRT modular robotics runtime and middleware components.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::schema::SchemaVersion;

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum CompatibilityPolicy {
    Exact,
    BackwardCompatible,
    ForwardCompatible,
}

impl CompatibilityPolicy {
    pub fn check(self, writer: SchemaVersion, reader: SchemaVersion) -> bool {
        match self {
            Self::Exact => writer == reader,
            Self::BackwardCompatible => writer.0 >= reader.0,
            Self::ForwardCompatible => writer.0 <= reader.0,
        }
    }
}