Struct i2c_linux::Functionality
source · pub struct Functionality { /* private fields */ }
Expand description
To determine what functionality is present
Implementations
sourceimpl Functionality
impl Functionality
sourcepub const I2C: Functionality = Self{ bits: I2C_FUNC_I2C,}
pub const I2C: Functionality = Self{ bits: I2C_FUNC_I2C,}
Plain i2c-level commands (I2C_RDWR
)
Pure SMBus adapters typically can not do these.
sourcepub const TENBIT_ADDR: Functionality = Self{ bits: I2C_FUNC_10BIT_ADDR,}
pub const TENBIT_ADDR: Functionality = Self{ bits: I2C_FUNC_10BIT_ADDR,}
Handles the 10-bit address extensions
sourcepub const PROTOCOL_MANGLING: Functionality = Self{ bits: I2C_FUNC_PROTOCOL_MANGLING,}
pub const PROTOCOL_MANGLING: Functionality = Self{ bits: I2C_FUNC_PROTOCOL_MANGLING,}
I2C_M_IGNORE_NAK etc.
pub const SMBUS_PEC: Functionality = Self{ bits: I2C_FUNC_SMBUS_PEC,}
sourcepub const NO_START: Functionality = Self{ bits: I2C_FUNC_NOSTART,}
pub const NO_START: Functionality = Self{ bits: I2C_FUNC_NOSTART,}
I2C_M_NOSTART
pub const SLAVE: Functionality = Self{ bits: I2C_FUNC_SLAVE,}
sourcepub const SMBUS_BLOCK_PROC_CALL: Functionality = Self{ bits: I2C_FUNC_SMBUS_BLOCK_PROC_CALL,}
pub const SMBUS_BLOCK_PROC_CALL: Functionality = Self{ bits: I2C_FUNC_SMBUS_BLOCK_PROC_CALL,}
SMBus 2.0
pub const SMBUS_QUICK: Functionality = Self{ bits: I2C_FUNC_SMBUS_QUICK,}
pub const SMBUS_READ_BYTE: Functionality = Self{ bits: I2C_FUNC_SMBUS_READ_BYTE,}
pub const SMBUS_WRITE_BYTE: Functionality = Self{ bits: I2C_FUNC_SMBUS_WRITE_BYTE,}
pub const SMBUS_READ_BYTE_DATA: Functionality = Self{ bits: I2C_FUNC_SMBUS_READ_BYTE_DATA,}
pub const SMBUS_WRITE_BYTE_DATA: Functionality = Self{ bits: I2C_FUNC_SMBUS_WRITE_BYTE_DATA,}
pub const SMBUS_READ_WORD_DATA: Functionality = Self{ bits: I2C_FUNC_SMBUS_READ_WORD_DATA,}
pub const SMBUS_WRITE_WORD_DATA: Functionality = Self{ bits: I2C_FUNC_SMBUS_WRITE_WORD_DATA,}
pub const SMBUS_PROC_CALL: Functionality = Self{ bits: I2C_FUNC_SMBUS_PROC_CALL,}
pub const SMBUS_READ_BLOCK_DATA: Functionality = Self{ bits: I2C_FUNC_SMBUS_READ_BLOCK_DATA,}
pub const SMBUS_WRITE_BLOCK_DATA: Functionality = Self{ bits: I2C_FUNC_SMBUS_WRITE_BLOCK_DATA,}
sourcepub const SMBUS_READ_I2C_BLOCK: Functionality = Self{ bits: I2C_FUNC_SMBUS_READ_I2C_BLOCK,}
pub const SMBUS_READ_I2C_BLOCK: Functionality = Self{ bits: I2C_FUNC_SMBUS_READ_I2C_BLOCK,}
I2C-like block xfer
sourcepub const SMBUS_WRITE_I2C_BLOCK: Functionality = Self{ bits: I2C_FUNC_SMBUS_WRITE_I2C_BLOCK,}
pub const SMBUS_WRITE_I2C_BLOCK: Functionality = Self{ bits: I2C_FUNC_SMBUS_WRITE_I2C_BLOCK,}
w/ 1-byte reg. addr.
pub const SMBUS_HOST_NOTIFY: Functionality = Self{ bits: I2C_FUNC_SMBUS_HOST_NOTIFY,}
pub const SMBUS_BYTE: Functionality = Self{ bits: I2C_FUNC_SMBUS_BYTE,}
pub const SMBUS_BYTE_DATA: Functionality = Self{ bits: I2C_FUNC_SMBUS_BYTE_DATA,}
pub const SMBUS_WORD_DATA: Functionality = Self{ bits: I2C_FUNC_SMBUS_WORD_DATA,}
pub const SMBUS_BLOCK_DATA: Functionality = Self{ bits: I2C_FUNC_SMBUS_BLOCK_DATA,}
pub const SMBUS_I2C_BLOCK: Functionality = Self{ bits: I2C_FUNC_SMBUS_I2C_BLOCK,}
pub const SMBUS_EMUL: Functionality = Self{ bits: I2C_FUNC_SMBUS_EMUL,}
sourcepub const fn empty() -> Functionality
pub const fn empty() -> Functionality
Returns an empty set of flags.
sourcepub const fn all() -> Functionality
pub const fn all() -> Functionality
Returns the set containing all flags.
sourcepub const fn from_bits(bits: u32) -> Option<Functionality>
pub const fn from_bits(bits: u32) -> Option<Functionality>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
sourcepub const fn from_bits_truncate(bits: u32) -> Functionality
pub const fn from_bits_truncate(bits: u32) -> Functionality
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
sourcepub const unsafe fn from_bits_unchecked(bits: u32) -> Functionality
pub const unsafe fn from_bits_unchecked(bits: u32) -> Functionality
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: Functionality) -> bool
pub const fn intersects(&self, other: Functionality) -> bool
Returns true
if there are flags common to both self
and other
.
sourcepub const fn contains(&self, other: Functionality) -> bool
pub const fn contains(&self, other: Functionality) -> bool
Returns true
if all of the flags in other
are contained within self
.
sourcepub fn insert(&mut self, other: Functionality)
pub fn insert(&mut self, other: Functionality)
Inserts the specified flags in-place.
sourcepub fn remove(&mut self, other: Functionality)
pub fn remove(&mut self, other: Functionality)
Removes the specified flags in-place.
sourcepub fn toggle(&mut self, other: Functionality)
pub fn toggle(&mut self, other: Functionality)
Toggles the specified flags in-place.
sourcepub fn set(&mut self, other: Functionality, value: bool)
pub fn set(&mut self, other: Functionality, value: bool)
Inserts or removes the specified flags depending on the passed value.
sourcepub const fn intersection(self, other: Functionality) -> Functionality
pub const fn intersection(self, other: Functionality) -> Functionality
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: Functionality) -> Functionality
pub const fn union(self, other: Functionality) -> Functionality
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: Functionality) -> Functionality
pub const fn difference(self, other: Functionality) -> Functionality
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: Functionality) -> Functionality
pub const fn symmetric_difference(self, other: Functionality) -> Functionality
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) -> Functionality
pub const fn complement(self) -> Functionality
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
sourceimpl Binary for Functionality
impl Binary for Functionality
sourceimpl BitAnd<Functionality> for Functionality
impl BitAnd<Functionality> for Functionality
sourcefn bitand(self, other: Functionality) -> Functionality
fn bitand(self, other: Functionality) -> Functionality
Returns the intersection between the two sets of flags.
type Output = Functionality
type Output = Functionality
&
operator.sourceimpl BitAndAssign<Functionality> for Functionality
impl BitAndAssign<Functionality> for Functionality
sourcefn bitand_assign(&mut self, other: Functionality)
fn bitand_assign(&mut self, other: Functionality)
Disables all flags disabled in the set.
sourceimpl BitOr<Functionality> for Functionality
impl BitOr<Functionality> for Functionality
sourcefn bitor(self, other: Functionality) -> Functionality
fn bitor(self, other: Functionality) -> Functionality
Returns the union of the two sets of flags.
type Output = Functionality
type Output = Functionality
|
operator.sourceimpl BitOrAssign<Functionality> for Functionality
impl BitOrAssign<Functionality> for Functionality
sourcefn bitor_assign(&mut self, other: Functionality)
fn bitor_assign(&mut self, other: Functionality)
Adds the set of flags.
sourceimpl BitXor<Functionality> for Functionality
impl BitXor<Functionality> for Functionality
sourcefn bitxor(self, other: Functionality) -> Functionality
fn bitxor(self, other: Functionality) -> Functionality
Returns the left flags, but with all the right flags toggled.
type Output = Functionality
type Output = Functionality
^
operator.sourceimpl BitXorAssign<Functionality> for Functionality
impl BitXorAssign<Functionality> for Functionality
sourcefn bitxor_assign(&mut self, other: Functionality)
fn bitxor_assign(&mut self, other: Functionality)
Toggles the set of flags.
sourceimpl Clone for Functionality
impl Clone for Functionality
sourcefn clone(&self) -> Functionality
fn clone(&self) -> Functionality
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for Functionality
impl Debug for Functionality
sourceimpl Extend<Functionality> for Functionality
impl Extend<Functionality> for Functionality
sourcefn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = Functionality>,
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = Functionality>,
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)sourceimpl FromIterator<Functionality> for Functionality
impl FromIterator<Functionality> for Functionality
sourcefn from_iter<T>(iterator: T) -> Functionalitywhere
T: IntoIterator<Item = Functionality>,
fn from_iter<T>(iterator: T) -> Functionalitywhere
T: IntoIterator<Item = Functionality>,
sourceimpl Hash for Functionality
impl Hash for Functionality
sourceimpl LowerHex for Functionality
impl LowerHex for Functionality
sourceimpl Not for Functionality
impl Not for Functionality
sourcefn not(self) -> Functionality
fn not(self) -> Functionality
Returns the complement of this set of flags.
type Output = Functionality
type Output = Functionality
!
operator.sourceimpl Octal for Functionality
impl Octal for Functionality
sourceimpl Ord for Functionality
impl Ord for Functionality
sourcefn cmp(&self, other: &Functionality) -> Ordering
fn cmp(&self, other: &Functionality) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
sourceimpl PartialEq<Functionality> for Functionality
impl PartialEq<Functionality> for Functionality
sourcefn eq(&self, other: &Functionality) -> bool
fn eq(&self, other: &Functionality) -> bool
sourceimpl PartialOrd<Functionality> for Functionality
impl PartialOrd<Functionality> for Functionality
sourcefn partial_cmp(&self, other: &Functionality) -> Option<Ordering>
fn partial_cmp(&self, other: &Functionality) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresourceimpl Sub<Functionality> for Functionality
impl Sub<Functionality> for Functionality
sourcefn sub(self, other: Functionality) -> Functionality
fn sub(self, other: Functionality) -> Functionality
Returns the set difference of the two sets of flags.
type Output = Functionality
type Output = Functionality
-
operator.sourceimpl SubAssign<Functionality> for Functionality
impl SubAssign<Functionality> for Functionality
sourcefn sub_assign(&mut self, other: Functionality)
fn sub_assign(&mut self, other: Functionality)
Disables all flags enabled in the set.