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>where
Enum: Flag,
impl<Enum> Flags<Enum>where
Enum: Flag,
sourcepub fn from_bits(bits: <Enum as Flag>::Primitive) -> Flags<Enum>
pub fn from_bits(bits: <Enum as Flag>::Primitive) -> Flags<Enum>
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) -> bool
pub fn intersects<B>(self, rhs: B) -> bool
Check if at least one flag in common is set
pub fn is_empty(&self) -> bool
pub fn is_all(&self) -> bool
Trait Implementations§
source§impl<T, B> BitAndAssign<B> for Flags<T>
impl<T, B> BitAndAssign<B> for Flags<T>
source§fn bitand_assign(&mut self, rhs: B)
fn bitand_assign(&mut self, rhs: B)
Performs the
&=
operation. Read moresource§impl<T, B> BitOrAssign<B> for Flags<T>
impl<T, B> BitOrAssign<B> for Flags<T>
source§fn bitor_assign(&mut self, rhs: B)
fn bitor_assign(&mut self, rhs: B)
Performs the
|=
operation. Read moresource§impl<T, B> BitXorAssign<B> for Flags<T>
impl<T, B> BitXorAssign<B> for Flags<T>
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.
source§impl<Enum> PartialEq<Enum> for Flags<Enum>where
Enum: Flag,
impl<Enum> PartialEq<Enum> for Flags<Enum>where
Enum: Flag,
source§impl PartialEq<Flags<AccessType>> for AccessType
impl PartialEq<Flags<AccessType>> for AccessType
source§impl PartialEq<Flags<CodeCategory>> for CodeCategory
impl PartialEq<Flags<CodeCategory>> for CodeCategory
source§impl PartialEq<Flags<ErrorFlags>> for ErrorFlags
impl PartialEq<Flags<ErrorFlags>> for ErrorFlags
source§impl<Enum, Primitive> PartialEq for Flags<Enum, Primitive>
impl<Enum, Primitive> PartialEq for Flags<Enum, Primitive>
impl<Enum, Primitive> Copy for Flags<Enum, Primitive>
impl<Enum, Primitive> Eq for Flags<Enum, Primitive>
impl<Enum, Primitive> StructuralPartialEq for Flags<Enum, Primitive>
Auto Trait Implementations§
impl<Enum, Primitive> Freeze for Flags<Enum, Primitive>where
Primitive: Freeze,
impl<Enum, Primitive> RefUnwindSafe for Flags<Enum, Primitive>where
Primitive: RefUnwindSafe,
Enum: RefUnwindSafe,
impl<Enum, Primitive> Send for Flags<Enum, Primitive>
impl<Enum, Primitive> Sync for Flags<Enum, Primitive>
impl<Enum, Primitive> Unpin for Flags<Enum, Primitive>
impl<Enum, Primitive> UnwindSafe for Flags<Enum, Primitive>where
Primitive: UnwindSafe,
Enum: UnwindSafe,
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<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)