pub struct ColorSet(/* private fields */);Expand description
A set of 0-5 colors, stored as a u8 bitmask. All 32 combinations are valid.
Mirrors Java ColorSet — the ordinal IS the bitmask.
Implementations§
Source§impl ColorSet
impl ColorSet
pub const COLORLESS: ColorSet
pub const WHITE: ColorSet
pub const BLUE: ColorSet
pub const BLACK: ColorSet
pub const RED: ColorSet
pub const GREEN: ColorSet
pub const ALL_COLORS: ColorSet
pub fn from_mask(mask: u8) -> Self
pub fn mask(self) -> u8
pub fn is_colorless(self) -> bool
pub fn is_multicolor(self) -> bool
pub fn is_mono_color(self) -> bool
pub fn count_colors(self) -> u32
pub fn has_color(self, color: Color) -> bool
pub fn has_white(self) -> bool
pub fn has_blue(self) -> bool
pub fn has_black(self) -> bool
pub fn has_red(self) -> bool
pub fn has_green(self) -> bool
pub fn has_any_color(self, mask: u8) -> bool
pub fn has_all_colors(self, mask: u8) -> bool
pub fn contains_all_colors_from(self, other: ColorSet) -> bool
pub fn union(self, other: ColorSet) -> ColorSet
pub fn intersection(self, other: ColorSet) -> ColorSet
pub fn inverse(self) -> ColorSet
pub fn iter(self) -> impl Iterator<Item = Color>
pub fn from_names(s: &str) -> Self
Trait Implementations§
impl Copy for ColorSet
Source§impl<'de> Deserialize<'de> for ColorSet
impl<'de> Deserialize<'de> for ColorSet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ColorSet
impl StructuralPartialEq for ColorSet
Auto Trait Implementations§
impl Freeze for ColorSet
impl RefUnwindSafe for ColorSet
impl Send for ColorSet
impl Sync for ColorSet
impl Unpin for ColorSet
impl UnsafeUnpin for ColorSet
impl UnwindSafe for ColorSet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more