pub struct BitFlags<F, U>{ /* private fields */ }Implementations§
Source§impl<F, U> BitFlags<F, U>
impl<F, U> BitFlags<F, U>
pub const unsafe fn from_flags_unchecked(flags: U) -> BitFlags<F, U>
Sourcepub fn try_from_flags(flags: U) -> Option<BitFlags<F, U>>
pub fn try_from_flags(flags: U) -> Option<BitFlags<F, U>>
Return None if the flags contains unknow toggled bit (greater than F::MAX)
pub fn from_flags(flags: U) -> BitFlags<F, U>
pub fn from_flag(flag: F) -> BitFlags<F, U>
pub fn new() -> BitFlags<F, U>
pub fn flags(self) -> U
Source§impl<F, U> BitFlags<F, U>
impl<F, U> BitFlags<F, U>
Sourcepub fn added(self, flag: F) -> BitFlags<F, U>
pub fn added(self, flag: F) -> BitFlags<F, U>
Set the flag to 1, even if the flag was already 1
Sourcepub fn removed(self, flag: F) -> BitFlags<F, U>
pub fn removed(self, flag: F) -> BitFlags<F, U>
Set the flag to 0, even if the flag was already 0
Sourcepub fn add(&mut self, flag: F) -> &mut BitFlags<F, U>
pub fn add(&mut self, flag: F) -> &mut BitFlags<F, U>
Set the flag to 1, even if the flag was already 1
Sourcepub fn remove(&mut self, flag: F) -> &mut BitFlags<F, U>
pub fn remove(&mut self, flag: F) -> &mut BitFlags<F, U>
Set the flag to 0, even if the flag was already 0
pub fn have_any(&self, flags: &[F]) -> bool
pub fn have_all(&self, flags: &[F]) -> bool
Trait Implementations§
Source§impl<F, U> BitAndAssign for BitFlags<F, U>
impl<F, U> BitAndAssign for BitFlags<F, U>
Source§fn bitand_assign(&mut self, rhs: BitFlags<F, U>)
fn bitand_assign(&mut self, rhs: BitFlags<F, U>)
Performs the
&= operation. Read moreSource§impl<F, U> BitAndAssign<F> for BitFlags<F, U>
impl<F, U> BitAndAssign<F> for BitFlags<F, U>
Source§fn bitand_assign(&mut self, rhs: F)
fn bitand_assign(&mut self, rhs: F)
Performs the
&= operation. Read moreSource§impl<F, U> BitOrAssign for BitFlags<F, U>
impl<F, U> BitOrAssign for BitFlags<F, U>
Source§fn bitor_assign(&mut self, rhs: BitFlags<F, U>)
fn bitor_assign(&mut self, rhs: BitFlags<F, U>)
Performs the
|= operation. Read moreSource§impl<F, U> BitOrAssign<F> for BitFlags<F, U>
impl<F, U> BitOrAssign<F> for BitFlags<F, U>
Source§fn bitor_assign(&mut self, rhs: F)
fn bitor_assign(&mut self, rhs: F)
Performs the
|= operation. Read moreSource§impl<F, U> BitXorAssign for BitFlags<F, U>
impl<F, U> BitXorAssign for BitFlags<F, U>
Source§fn bitxor_assign(&mut self, rhs: BitFlags<F, U>)
fn bitxor_assign(&mut self, rhs: BitFlags<F, U>)
Performs the
^= operation. Read moreSource§impl<F, U> BitXorAssign<F> for BitFlags<F, U>
impl<F, U> BitXorAssign<F> for BitFlags<F, U>
Source§fn bitxor_assign(&mut self, rhs: F)
fn bitxor_assign(&mut self, rhs: F)
Performs the
^= operation. Read moreimpl<F, U> Copy for BitFlags<F, U>
Source§impl<F, U> Debug for BitFlags<F, U>where
U: BitFlagsIntegerUnsigned + From<F>,
F: MaxValue + Copy + TryFrom<U> + Debug,
RangeInclusive<U>: Iterator<Item = U>,
impl<F, U> Debug for BitFlags<F, U>where
U: BitFlagsIntegerUnsigned + From<F>,
F: MaxValue + Copy + TryFrom<U> + Debug,
RangeInclusive<U>: Iterator<Item = U>,
Source§impl<'de, F, U> Deserialize<'de> for BitFlags<F, U>
Available on crate feature serde only.
impl<'de, F, U> Deserialize<'de> for BitFlags<F, U>
Available on crate feature
serde only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<BitFlags<F, U>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<BitFlags<F, U>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<F, U> Eq for BitFlags<F, U>
Source§impl<F, U> IntoIterator for BitFlags<F, U>where
U: BitFlagsIntegerUnsigned + From<F>,
F: MaxValue + Copy + TryFrom<U>,
RangeInclusive<U>: Iterator<Item = U>,
impl<F, U> IntoIterator for BitFlags<F, U>where
U: BitFlagsIntegerUnsigned + From<F>,
F: MaxValue + Copy + TryFrom<U>,
RangeInclusive<U>: Iterator<Item = U>,
Source§impl<F, U> Ord for BitFlags<F, U>
impl<F, U> Ord for BitFlags<F, U>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl<F, U> PartialOrd for BitFlags<F, U>
impl<F, U> PartialOrd for BitFlags<F, U>
Source§impl<F, U> Serialize for BitFlags<F, U>
Available on crate feature serde only.
impl<F, U> Serialize for BitFlags<F, U>
Available on crate feature
serde only.Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<F, U> StructuralPartialEq for BitFlags<F, U>
Auto Trait Implementations§
impl<F, U> Freeze for BitFlags<F, U>
impl<F, U> RefUnwindSafe for BitFlags<F, U>
impl<F, U> Send for BitFlags<F, U>
impl<F, U> Sync for BitFlags<F, U>
impl<F, U> Unpin for BitFlags<F, U>
impl<F, U> UnsafeUnpin for BitFlags<F, U>
impl<F, U> UnwindSafe for BitFlags<F, U>
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
Source§impl<Src, Dest> CastRangeFrom<Dest> for Srcwhere
Dest: CastRangeInto<Src>,
impl<Src, Dest> CastRangeFrom<Dest> for Srcwhere
Dest: CastRangeInto<Src>,
fn cast_range_from(value: Dest) -> Src
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<I, T> CollectExtension<T> for Iwhere
I: IntoIterator<Item = T>,
impl<I, T> CollectExtension<T> for Iwhere
I: IntoIterator<Item = T>,
fn to_vec(self) -> Vec<T>
fn to_linkedlist(self) -> LinkedList<T>
fn to_vecdeque(self) -> VecDeque<T>
fn to_hashset(self) -> HashSet<T>
fn to_btreeset(self) -> BTreeSet<T>where
T: Ord,
Source§impl<I, T1> CollectToGenVecExtension<T1> for Iwhere
I: IntoIterator<Item = T1>,
impl<I, T1> CollectToGenVecExtension<T1> for Iwhere
I: IntoIterator<Item = T1>,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<C, T, const N: usize> ExtensionFromArray<T, N> for C
impl<C, T, const N: usize> ExtensionFromArray<T, N> for C
fn from_array(value: [T; N]) -> Self
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PartialOrdExtension for Twhere
T: PartialOrd,
impl<T> PartialOrdExtension for Twhere
T: PartialOrd,
fn max_partial(self, other: Self) -> Selfwhere
Self: Sized,
fn min_partial(self, other: Self) -> Selfwhere
Self: Sized,
fn clamp_partial(self, min: Self, max: Self) -> Selfwhere
Self: Sized,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PositiveOrNegative for Twhere
T: Zero + PartialOrd,
impl<T> PositiveOrNegative for Twhere
T: Zero + PartialOrd,
Source§fn is_positive_or_zero(&self) -> bool
fn is_positive_or_zero(&self) -> bool
Is >= 0 Read more
Source§fn is_negative_or_zero(&self) -> bool
fn is_negative_or_zero(&self) -> bool
Is <= 0 Read more
Source§fn is_strictly_positive(&self) -> bool
fn is_strictly_positive(&self) -> bool
Is > 0 Read more
Source§fn is_strictly_negative(&self) -> bool
fn is_strictly_negative(&self) -> bool
Is < 0 Read more