use std::ops::{BitOr, BitOrAssign};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct Interests(u32);
impl Interests {
pub const NONE: Interests = Interests(0);
pub const CHAT: Interests = Interests(1 << 0);
pub const ENTITIES: Interests = Interests(1 << 1);
pub const PLAYER_LIST: Interests = Interests(1 << 2);
pub const PLAYER_SKINS: Interests = Interests(1 << 4);
pub const BLOCK_UPDATES: Interests = Interests(1 << 3);
#[must_use]
pub const fn contains(self, other: Interests) -> bool {
self.0 & other.0 == other.0
}
#[must_use]
pub const fn union(self, other: Interests) -> Interests {
Interests(self.0 | other.0)
}
}
impl BitOr for Interests {
type Output = Interests;
fn bitor(self, rhs: Interests) -> Interests {
self.union(rhs)
}
}
impl BitOrAssign for Interests {
fn bitor_assign(&mut self, rhs: Interests) {
*self = self.union(rhs);
}
}