pub struct WatchKind { /* private fields */ }
Implementations§
§impl WatchKind
impl WatchKind
pub const fn from_bits(bits: u8) -> Option<WatchKind>
pub const fn from_bits(bits: u8) -> Option<WatchKind>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
pub const fn from_bits_truncate(bits: u8) -> WatchKind
pub const fn from_bits_truncate(bits: u8) -> WatchKind
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
pub const unsafe fn from_bits_unchecked(bits: u8) -> WatchKind
pub const unsafe fn from_bits_unchecked(bits: u8) -> WatchKind
Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
Safety
The caller of the bitflags!
macro can chose to allow or
disallow extra bits for their bitflags type.
The caller of from_bits_unchecked()
has to ensure that
all bits correspond to a defined flag or that extra bits
are valid for this bitflags type.
pub const fn intersects(&self, other: WatchKind) -> bool
pub const fn intersects(&self, other: WatchKind) -> bool
Returns true
if there are flags common to both self
and other
.
pub const fn contains(&self, other: WatchKind) -> bool
pub const fn contains(&self, other: WatchKind) -> bool
Returns true
if all of the flags in other
are contained within self
.
pub fn set(&mut self, other: WatchKind, value: bool)
pub fn set(&mut self, other: WatchKind, value: bool)
Inserts or removes the specified flags depending on the passed value.
pub const fn intersection(self, other: WatchKind) -> WatchKind
pub const fn intersection(self, other: WatchKind) -> WatchKind
Returns the intersection between the flags in self
and
other
.
Specifically, the returned set contains only the flags which are
present in both self
and other
.
This is equivalent to using the &
operator (e.g.
ops::BitAnd
), as in flags & other
.
pub const fn union(self, other: WatchKind) -> WatchKind
pub const fn union(self, other: WatchKind) -> WatchKind
Returns the union of between the flags in self
and other
.
Specifically, the returned set contains all flags which are
present in either self
or other
, including any which are
present in both (see Self::symmetric_difference
if that
is undesirable).
This is equivalent to using the |
operator (e.g.
ops::BitOr
), as in flags | other
.
pub const fn difference(self, other: WatchKind) -> WatchKind
pub const fn difference(self, other: WatchKind) -> WatchKind
Returns the difference between the flags in self
and other
.
Specifically, the returned set contains all flags present in
self
, except for the ones present in other
.
It is also conceptually equivalent to the “bit-clear” operation:
flags & !other
(and this syntax is also supported).
This is equivalent to using the -
operator (e.g.
ops::Sub
), as in flags - other
.
pub const fn symmetric_difference(self, other: WatchKind) -> WatchKind
pub const fn symmetric_difference(self, other: WatchKind) -> WatchKind
Returns the symmetric difference between the flags
in self
and other
.
Specifically, the returned set contains the flags present which
are present in self
or other
, but that are not present in
both. Equivalently, it contains the flags present in exactly
one of the sets self
and other
.
This is equivalent to using the ^
operator (e.g.
ops::BitXor
), as in flags ^ other
.
pub const fn complement(self) -> WatchKind
pub const fn complement(self) -> WatchKind
Returns the complement of this set of flags.
Specifically, the returned set contains all the flags which are
not set in self
, but which are allowed for this type.
Alternatively, it can be thought of as the set difference
between Self::all()
and self
(e.g. Self::all() - self
)
This is equivalent to using the !
operator (e.g.
ops::Not
), as in !flags
.
Trait Implementations§
§impl BitAndAssign<WatchKind> for WatchKind
impl BitAndAssign<WatchKind> for WatchKind
§fn bitand_assign(&mut self, other: WatchKind)
fn bitand_assign(&mut self, other: WatchKind)
Disables all flags disabled in the set.
§impl BitOrAssign<WatchKind> for WatchKind
impl BitOrAssign<WatchKind> for WatchKind
§fn bitor_assign(&mut self, other: WatchKind)
fn bitor_assign(&mut self, other: WatchKind)
Adds the set of flags.
§impl BitXorAssign<WatchKind> for WatchKind
impl BitXorAssign<WatchKind> for WatchKind
§fn bitxor_assign(&mut self, other: WatchKind)
fn bitxor_assign(&mut self, other: WatchKind)
Toggles the set of flags.
§impl<'de> Deserialize<'de> for WatchKind
impl<'de> Deserialize<'de> for WatchKind
§fn deserialize<D>(
deserializer: D
) -> Result<WatchKind, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>( deserializer: D ) -> Result<WatchKind, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
§impl Extend<WatchKind> for WatchKind
impl Extend<WatchKind> for WatchKind
§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = WatchKind>,
fn extend<T>(&mut self, iterator: T)where T: IntoIterator<Item = WatchKind>,
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)§impl FromIterator<WatchKind> for WatchKind
impl FromIterator<WatchKind> for WatchKind
§impl Ord for WatchKind
impl Ord for WatchKind
§impl PartialOrd<WatchKind> for WatchKind
impl PartialOrd<WatchKind> for WatchKind
§fn partial_cmp(&self, other: &WatchKind) -> Option<Ordering>
fn partial_cmp(&self, other: &WatchKind) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more§impl Serialize for WatchKind
impl Serialize for WatchKind
§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,
§impl SubAssign<WatchKind> for WatchKind
impl SubAssign<WatchKind> for WatchKind
§fn sub_assign(&mut self, other: WatchKind)
fn sub_assign(&mut self, other: WatchKind)
Disables all flags enabled in the set.
impl Copy for WatchKind
impl Eq for WatchKind
impl StructuralEq for WatchKind
impl StructuralPartialEq for WatchKind
Auto Trait Implementations§
impl RefUnwindSafe for WatchKind
impl Send for WatchKind
impl Sync for WatchKind
impl Unpin for WatchKind
impl UnwindSafe for WatchKind
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.