pub struct Roles { /* private fields */ }
Expand description
Bitmask of the roles that a node fulfills.
Implementations§
Source§impl Roles
impl Roles
Sourcepub const fn from_bits(bits: u8) -> Option<Roles>
pub const fn from_bits(bits: u8) -> Option<Roles>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
Sourcepub const fn from_bits_truncate(bits: u8) -> Roles
pub const fn from_bits_truncate(bits: u8) -> Roles
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
Sourcepub const unsafe fn from_bits_unchecked(bits: u8) -> Roles
pub const unsafe fn from_bits_unchecked(bits: u8) -> Roles
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.
Sourcepub const fn intersects(&self, other: Roles) -> bool
pub const fn intersects(&self, other: Roles) -> bool
Returns true
if there are flags common to both self
and other
.
Sourcepub const fn contains(&self, other: Roles) -> bool
pub const fn contains(&self, other: Roles) -> bool
Returns true
if all of the flags in other
are contained within self
.
Sourcepub fn set(&mut self, other: Roles, value: bool)
pub fn set(&mut self, other: Roles, value: bool)
Inserts or removes the specified flags depending on the passed value.
Sourcepub const fn intersection(self, other: Roles) -> Roles
pub const fn intersection(self, other: Roles) -> Roles
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
.
Sourcepub const fn union(self, other: Roles) -> Roles
pub const fn union(self, other: Roles) -> Roles
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
.
Sourcepub const fn difference(self, other: Roles) -> Roles
pub const fn difference(self, other: Roles) -> Roles
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
.
Sourcepub const fn symmetric_difference(self, other: Roles) -> Roles
pub const fn symmetric_difference(self, other: Roles) -> Roles
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
.
Sourcepub const fn complement(self) -> Roles
pub const fn complement(self) -> Roles
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§
Source§impl BitAndAssign for Roles
impl BitAndAssign for Roles
Source§fn bitand_assign(&mut self, other: Roles)
fn bitand_assign(&mut self, other: Roles)
Disables all flags disabled in the set.
Source§impl BitOrAssign for Roles
impl BitOrAssign for Roles
Source§fn bitor_assign(&mut self, other: Roles)
fn bitor_assign(&mut self, other: Roles)
Adds the set of flags.
Source§impl BitXorAssign for Roles
impl BitXorAssign for Roles
Source§fn bitxor_assign(&mut self, other: Roles)
fn bitxor_assign(&mut self, other: Roles)
Toggles the set of flags.
Source§impl Decode for Roles
impl Decode for Roles
Source§fn decode<I>(input: &mut I) -> Result<Roles, Error>where
I: Input,
fn decode<I>(input: &mut I) -> Result<Roles, Error>where
I: Input,
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Source§impl Encode for Roles
impl Encode for Roles
Source§fn encode_to<T>(&self, dest: &mut T)
fn encode_to<T>(&self, dest: &mut T)
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
Source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Source§impl Extend<Roles> for Roles
impl Extend<Roles> for Roles
Source§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = Roles>,
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = Roles>,
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
)Source§impl From<Roles> for ObservedRole
impl From<Roles> for ObservedRole
Source§fn from(roles: Roles) -> ObservedRole
fn from(roles: Roles) -> ObservedRole
Source§impl FromIterator<Roles> for Roles
impl FromIterator<Roles> for Roles
Source§impl Ord for Roles
impl Ord for Roles
Source§impl PartialOrd for Roles
impl PartialOrd for Roles
Source§impl SubAssign for Roles
impl SubAssign for Roles
Source§fn sub_assign(&mut self, other: Roles)
fn sub_assign(&mut self, other: Roles)
Disables all flags enabled in the set.
impl Copy for Roles
impl EncodeLike for Roles
impl Eq for Roles
impl StructuralPartialEq for Roles
Auto Trait Implementations§
impl Freeze for Roles
impl RefUnwindSafe for Roles
impl Send for Roles
impl Sync for Roles
impl Unpin for Roles
impl UnwindSafe for Roles
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<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>
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>
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, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read moreSource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.