pub struct EnumSet<T: EnumSetHelper<BitsetWord>, BitsetWord: BitsetWordTrait = u8> { /* private fields */ }Expand description
A set of enumoid T’s members.
The optional type parameter BitsetWord specifies the size of the words used to store the
bitset. Traits are defined for both u8 and usize.
Implementations§
Source§impl<T: EnumSetHelper<BitsetWord>, BitsetWord: BitsetWordTrait> EnumSet<T, BitsetWord>
impl<T: EnumSetHelper<BitsetWord>, BitsetWord: BitsetWordTrait> EnumSet<T, BitsetWord>
Sourcepub fn set_by_index(&mut self, index: EnumIndex<T>, flag: bool)
pub fn set_by_index(&mut self, index: EnumIndex<T>, flag: bool)
Sets whether a member index is in the set.
Sourcepub fn insert_by_index(&mut self, index: EnumIndex<T>) -> bool
pub fn insert_by_index(&mut self, index: EnumIndex<T>) -> bool
Adds a member index to the set and returns true if it was already present.
Sourcepub fn insert(&mut self, key: T) -> bool
pub fn insert(&mut self, key: T) -> bool
Adds a member to the set and returns true if it was already present.
Sourcepub fn remove_by_index(&mut self, index: EnumIndex<T>) -> bool
pub fn remove_by_index(&mut self, index: EnumIndex<T>) -> bool
Removes a member index from the set and returns true if it was present.
Sourcepub fn remove(&mut self, key: T) -> bool
pub fn remove(&mut self, key: T) -> bool
Removes a member from the set and returns true if it was present.
Sourcepub fn contains_index(&self, index: EnumIndex<T>) -> bool
pub fn contains_index(&self, index: EnumIndex<T>) -> bool
Returns true if a specific member index is in the set.
Trait Implementations§
Source§impl<T: Clone + EnumSetHelper<BitsetWord>, BitsetWord: Clone + BitsetWordTrait> Clone for EnumSet<T, BitsetWord>where
T::BitsetArray: Clone,
impl<T: Clone + EnumSetHelper<BitsetWord>, BitsetWord: Clone + BitsetWordTrait> Clone for EnumSet<T, BitsetWord>where
T::BitsetArray: Clone,
Source§impl<T: EnumSetHelper<BitsetWord> + Debug, BitsetWord: BitsetWordTrait> Debug for EnumSet<T, BitsetWord>
impl<T: EnumSetHelper<BitsetWord> + Debug, BitsetWord: BitsetWordTrait> Debug for EnumSet<T, BitsetWord>
Source§impl<T: EnumSetHelper<BitsetWord>, BitsetWord: BitsetWordTrait> Default for EnumSet<T, BitsetWord>
impl<T: EnumSetHelper<BitsetWord>, BitsetWord: BitsetWordTrait> Default for EnumSet<T, BitsetWord>
Source§impl<'de, T: EnumSetHelper<BitsetWord> + Deserialize<'de>, BitsetWord: BitsetWordTrait> Deserialize<'de> for EnumSet<T, BitsetWord>
impl<'de, T: EnumSetHelper<BitsetWord> + Deserialize<'de>, BitsetWord: BitsetWordTrait> Deserialize<'de> for EnumSet<T, BitsetWord>
Source§fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T: EnumSetHelper<BitsetWord>, BitsetWord: BitsetWordTrait> Hash for EnumSet<T, BitsetWord>
impl<T: EnumSetHelper<BitsetWord>, BitsetWord: BitsetWordTrait> Hash for EnumSet<T, BitsetWord>
Source§impl<T: EnumSetHelper<BitsetWord>, BitsetWord: BitsetWordTrait> Index<T> for EnumSet<T, BitsetWord>
impl<T: EnumSetHelper<BitsetWord>, BitsetWord: BitsetWordTrait> Index<T> for EnumSet<T, BitsetWord>
Source§impl<T: EnumSetHelper<BitsetWord>, BitsetWord: BitsetWordTrait> PartialEq for EnumSet<T, BitsetWord>
impl<T: EnumSetHelper<BitsetWord>, BitsetWord: BitsetWordTrait> PartialEq for EnumSet<T, BitsetWord>
Source§impl<T: EnumSetHelper<BitsetWord> + Serialize, BitsetWord: BitsetWordTrait> Serialize for EnumSet<T, BitsetWord>
impl<T: EnumSetHelper<BitsetWord> + Serialize, BitsetWord: BitsetWordTrait> Serialize for EnumSet<T, BitsetWord>
impl<T: Copy + EnumSetHelper<BitsetWord>, BitsetWord: Copy + BitsetWordTrait> Copy for EnumSet<T, BitsetWord>where
T::BitsetArray: Copy,
impl<T: EnumSetHelper<BitsetWord>, BitsetWord: BitsetWordTrait> Eq for EnumSet<T, BitsetWord>
Auto Trait Implementations§
impl<T, BitsetWord> Freeze for EnumSet<T, BitsetWord>
impl<T, BitsetWord> RefUnwindSafe for EnumSet<T, BitsetWord>
impl<T, BitsetWord> Send for EnumSet<T, BitsetWord>
impl<T, BitsetWord> Sync for EnumSet<T, BitsetWord>
impl<T, BitsetWord> Unpin for EnumSet<T, BitsetWord>
impl<T, BitsetWord> UnwindSafe for EnumSet<T, BitsetWord>
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