Struct sawp_modbus::Flags
source · pub struct Flags<Enum, Primitive = <Enum as Flag>::Primitive> { /* private fields */ }
Expand description
Re-export of the Flags
struct that is used to represent bit flags
in this crate.
Storage type for handling flags
Implementations§
source§impl<Enum> Flags<Enum, <Enum as Flag>::Primitive>where
Enum: Flag,
impl<Enum> Flags<Enum, <Enum as Flag>::Primitive>where Enum: Flag,
sourcepub fn from_flag(flag: Enum) -> Flags<Enum, <Enum as Flag>::Primitive>
pub fn from_flag(flag: Enum) -> Flags<Enum, <Enum as Flag>::Primitive>
Get a flag from a single enum value
sourcepub fn from_bits(
bits: <Enum as Flag>::Primitive
) -> Flags<Enum, <Enum as Flag>::Primitive>
pub fn from_bits( bits: <Enum as Flag>::Primitive ) -> Flags<Enum, <Enum as Flag>::Primitive>
Get a flag from a numeric value
Note: the value is unchecked so any bit may be set. Be
careful because PartialEq
is a direct comparison of
underlying bits.
sourcepub fn bits_ref(&self) -> &<Enum as Flag>::Primitive
pub fn bits_ref(&self) -> &<Enum as Flag>::Primitive
Reference to numeric representation of the variant
sourcepub fn intersects<B>(self, rhs: B) -> boolwhere
B: Into<Flags<Enum, <Enum as Flag>::Primitive>>,
pub fn intersects<B>(self, rhs: B) -> boolwhere B: Into<Flags<Enum, <Enum as Flag>::Primitive>>,
Check if at least one flag in common is set
sourcepub fn contains<B>(self, rhs: B) -> boolwhere
B: Into<Flags<Enum, <Enum as Flag>::Primitive>>,
pub fn contains<B>(self, rhs: B) -> boolwhere B: Into<Flags<Enum, <Enum as Flag>::Primitive>>,
Check if all flags provided in rhs
are set
pub fn is_empty(&self) -> bool
pub fn is_all(&self) -> bool
Trait Implementations§
source§impl<T, B> BitAnd<B> for Flags<T, <T as Flag>::Primitive>where
T: Flag,
B: Into<Flags<T, <T as Flag>::Primitive>>,
impl<T, B> BitAnd<B> for Flags<T, <T as Flag>::Primitive>where T: Flag, B: Into<Flags<T, <T as Flag>::Primitive>>,
source§impl<T, B> BitAndAssign<B> for Flags<T, <T as Flag>::Primitive>where
T: Flag,
B: Into<Flags<T, <T as Flag>::Primitive>>,
impl<T, B> BitAndAssign<B> for Flags<T, <T as Flag>::Primitive>where T: Flag, B: Into<Flags<T, <T as Flag>::Primitive>>,
source§fn bitand_assign(&mut self, rhs: B)
fn bitand_assign(&mut self, rhs: B)
Performs the
&=
operation. Read moresource§impl<T, B> BitOr<B> for Flags<T, <T as Flag>::Primitive>where
T: Flag,
B: Into<Flags<T, <T as Flag>::Primitive>>,
impl<T, B> BitOr<B> for Flags<T, <T as Flag>::Primitive>where T: Flag, B: Into<Flags<T, <T as Flag>::Primitive>>,
source§impl<T, B> BitOrAssign<B> for Flags<T, <T as Flag>::Primitive>where
T: Flag,
B: Into<Flags<T, <T as Flag>::Primitive>>,
impl<T, B> BitOrAssign<B> for Flags<T, <T as Flag>::Primitive>where T: Flag, B: Into<Flags<T, <T as Flag>::Primitive>>,
source§fn bitor_assign(&mut self, rhs: B)
fn bitor_assign(&mut self, rhs: B)
Performs the
|=
operation. Read moresource§impl<T, B> BitXor<B> for Flags<T, <T as Flag>::Primitive>where
T: Flag,
B: Into<Flags<T, <T as Flag>::Primitive>>,
impl<T, B> BitXor<B> for Flags<T, <T as Flag>::Primitive>where T: Flag, B: Into<Flags<T, <T as Flag>::Primitive>>,
source§impl<T, B> BitXorAssign<B> for Flags<T, <T as Flag>::Primitive>where
T: Flag,
B: Into<Flags<T, <T as Flag>::Primitive>>,
impl<T, B> BitXorAssign<B> for Flags<T, <T as Flag>::Primitive>where T: Flag, B: Into<Flags<T, <T as Flag>::Primitive>>,
source§fn bitxor_assign(&mut self, rhs: B)
fn bitxor_assign(&mut self, rhs: B)
Performs the
^=
operation. Read moresource§impl From<FunctionCode> for Flags<AccessType>
impl From<FunctionCode> for Flags<AccessType>
source§fn from(code: FunctionCode) -> Self
fn from(code: FunctionCode) -> Self
Converts to this type from the input type.