use bevy_reflect::Reflect;
use std::ops;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Reflect)]
pub struct CVarFlags(pub u64);
impl CVarFlags {
pub const LOCAL: CVarFlags = CVarFlags(0);
pub const SAVED: CVarFlags = CVarFlags(0b0000_0001);
pub const MIRRORED: CVarFlags = CVarFlags(0b0000_0010);
pub const RUNTIME: CVarFlags = CVarFlags(0b0000_0100);
}
impl ops::BitOr for CVarFlags {
type Output = CVarFlags;
fn bitor(self, rhs: Self) -> Self::Output {
Self(self.0 | rhs.0)
}
}
impl ops::BitAnd for CVarFlags {
type Output = CVarFlags;
fn bitand(self, rhs: Self) -> Self::Output {
Self(self.0 & rhs.0)
}
}
impl CVarFlags {
#[must_use]
pub fn contains(&self, other: CVarFlags) -> bool {
let and = *self & other;
and.0 == other.0
}
}