#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct Dialect {
pub rti: bool,
pub cyclone: bool,
pub fast_dds: bool,
pub open_dds: bool,
pub ros2: bool,
}
impl Dialect {
pub const STRICT: Self = Self {
rti: false,
cyclone: false,
fast_dds: false,
open_dds: false,
ros2: false,
};
pub const ALL_VENDORS: Self = Self {
rti: true,
cyclone: true,
fast_dds: true,
open_dds: true,
ros2: false,
};
#[must_use]
pub const fn any_vendor(self) -> bool {
self.rti || self.cyclone || self.fast_dds || self.open_dds || self.ros2
}
#[must_use]
pub const fn flag_name(admitted_by: VendorFlag) -> &'static str {
match admitted_by {
VendorFlag::Rti => "rti",
VendorFlag::Cyclone => "cyclone",
VendorFlag::FastDds => "fast_dds",
VendorFlag::OpenDds => "open_dds",
VendorFlag::Ros2 => "ros2",
}
}
#[must_use]
pub const fn admits(self, flag: VendorFlag) -> bool {
match flag {
VendorFlag::Rti => self.rti,
VendorFlag::Cyclone => self.cyclone,
VendorFlag::FastDds => self.fast_dds,
VendorFlag::OpenDds => self.open_dds,
VendorFlag::Ros2 => self.ros2,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum VendorFlag {
Rti,
Cyclone,
FastDds,
OpenDds,
Ros2,
}
impl VendorFlag {
pub const ALL: [Self; 5] = [
Self::Rti,
Self::Cyclone,
Self::FastDds,
Self::OpenDds,
Self::Ros2,
];
}