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,

source

pub fn from_flag(flag: Enum) -> Flags<Enum, <Enum as Flag>::Primitive>

Get a flag from a single enum value

source

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.

source

pub fn bits(&self) -> <Enum as Flag>::Primitive

Numeric representation of the variant

source

pub fn bits_ref(&self) -> &<Enum as Flag>::Primitive

Reference to numeric representation of the variant

source

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

source

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

source

pub fn is_empty(&self) -> bool

source

pub fn is_all(&self) -> bool

Trait Implementations§

source§

impl<T> Binary for Flags<T, <T as Flag>::Primitive>where T: Flag,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter.
source§

impl<T, B> BitAnd<B> for Flags<T, <T as Flag>::Primitive>where T: Flag, B: Into<Flags<T, <T as Flag>::Primitive>>,

§

type Output = Flags<T, <T as Flag>::Primitive>

The resulting type after applying the & operator.
source§

fn bitand(self, other: B) -> Flags<T, <T as Flag>::Primitive>

Performs the & operation. Read more
source§

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)

Performs the &= operation. Read more
source§

impl<T, B> BitOr<B> for Flags<T, <T as Flag>::Primitive>where T: Flag, B: Into<Flags<T, <T as Flag>::Primitive>>,

§

type Output = Flags<T, <T as Flag>::Primitive>

The resulting type after applying the | operator.
source§

fn bitor(self, other: B) -> Flags<T, <T as Flag>::Primitive>

Performs the | operation. Read more
source§

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)

Performs the |= operation. Read more
source§

impl<T, B> BitXor<B> for Flags<T, <T as Flag>::Primitive>where T: Flag, B: Into<Flags<T, <T as Flag>::Primitive>>,

§

type Output = Flags<T, <T as Flag>::Primitive>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, other: B) -> Flags<T, <T as Flag>::Primitive>

Performs the ^ operation. Read more
source§

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)

Performs the ^= operation. Read more
source§

impl<Enum, Primitive> Clone for Flags<Enum, Primitive>where Enum: Clone, Primitive: Clone,

source§

fn clone(&self) -> Flags<Enum, Primitive>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Enum> Debug for Flags<Enum, <Enum as Flag>::Primitive>where Enum: Flag,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<Enum> Default for Flags<Enum, <Enum as Flag>::Primitive>where Enum: Flag,

source§

fn default() -> Flags<Enum, <Enum as Flag>::Primitive>

Returns the “default value” for a type. Read more
source§

impl<T> Display for Flags<T, <T as Flag>::Primitive>where T: Flag,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

A pipe-separated list of set flags.

source§

impl From<&Message> for Flags<CodeCategory>

source§

fn from(msg: &Message) -> Self

Converts to this type from the input type.
source§

impl<Enum> From<Enum> for Flags<Enum, <Enum as Flag>::Primitive>where Enum: Flag,

source§

fn from(flag: Enum) -> Flags<Enum, <Enum as Flag>::Primitive>

Converts to this type from the input type.
source§

impl From<FunctionCode> for Flags<AccessType>

source§

fn from(code: FunctionCode) -> Self

Converts to this type from the input type.
source§

impl<T> Not for Flags<T, <T as Flag>::Primitive>where T: Flag,

§

type Output = Flags<T, <T as Flag>::Primitive>

The resulting type after applying the ! operator.
source§

fn not(self) -> <Flags<T, <T as Flag>::Primitive> as Not>::Output

Performs the unary ! operation. Read more
source§

impl<Enum> PartialEq<Enum> for Flags<Enum, <Enum as Flag>::Primitive>where Enum: Flag,

source§

fn eq(&self, other: &Enum) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Flags<AccessType, <AccessType as Flag>::Primitive>> for AccessType

source§

fn eq(&self, other: &Flags<Self>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Flags<CodeCategory, <CodeCategory as Flag>::Primitive>> for CodeCategory

source§

fn eq(&self, other: &Flags<Self>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Enum, Primitive> PartialEq<Flags<Enum, Primitive>> for Flags<Enum, Primitive>where Enum: PartialEq<Enum>, Primitive: PartialEq<Primitive>,

source§

fn eq(&self, other: &Flags<Enum, Primitive>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Flags<ErrorFlags, <ErrorFlags as Flag>::Primitive>> for ErrorFlags

source§

fn eq(&self, other: &Flags<Self>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Enum, Primitive> Copy for Flags<Enum, Primitive>where Enum: Copy, Primitive: Copy,

source§

impl<Enum, Primitive> Eq for Flags<Enum, Primitive>where Enum: Eq, Primitive: Eq,

source§

impl<Enum, Primitive> StructuralEq for Flags<Enum, Primitive>

source§

impl<Enum, Primitive> StructuralPartialEq for Flags<Enum, Primitive>

Auto Trait Implementations§

§

impl<Enum, Primitive> RefUnwindSafe for Flags<Enum, Primitive>where Enum: RefUnwindSafe, Primitive: RefUnwindSafe,

§

impl<Enum, Primitive> Send for Flags<Enum, Primitive>where Enum: Send, Primitive: Send,

§

impl<Enum, Primitive> Sync for Flags<Enum, Primitive>where Enum: Sync, Primitive: Sync,

§

impl<Enum, Primitive> Unpin for Flags<Enum, Primitive>where Enum: Unpin, Primitive: Unpin,

§

impl<Enum, Primitive> UnwindSafe for Flags<Enum, Primitive>where Enum: UnwindSafe, Primitive: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.