pub struct DualStandardFilter { /* private fields */ }
Expand description

A filter that matches against two standard 11-bit standard ids.

The first filter part can match a packet’s id, rtr bit, and the first byte of the payload. The second filter part can match a packet’s id and rtr bit.

Warning: This is not a perfect filter. Extended ids that match the bit layout of this filter will also be accepted.

Implementations§

source§

impl DualStandardFilter

source

pub const fn new( first_id: &[u8; 11], first_rtr: &[u8; 1], first_payload: &[u8; 8], second_id: &[u8; 11], second_rtr: &[u8; 1] ) -> DualStandardFilter

Create a filter that matches against two standard 11-bit standard ids.

The first filter part can match a packet’s id, rtr bit, and the first byte of the payload. The second filter part can match a packet’s id and rtr bit.

§Examples

A filter that matches any standard id that ends with a 00 or a 11, with any rtr, and with any payload on the first filter.

const FILTER: twai::filter::DualStandardFilter = twai::filter::DualStandardFilter::new(
    b"xxxxxxxxx00",
    b"x",
    b"xxxxxxxx",
    b"xxxxxxxxx11",
    b"x",
);
source

pub fn new_from_code_mask( first_id_code: StandardId, first_id_mask: StandardId, first_rtr_code: bool, first_rtr_mask: bool, first_payload_code: u8, first_payload_mask: u8, second_id_code: StandardId, second_id_mask: StandardId, second_rtr_code: bool, second_rtr_mask: bool ) -> DualStandardFilter

The masks indicate which bits of the code the filter should match against. Set bits in the mask indicate that the corresponding bit in the code should match.

Trait Implementations§

source§

impl Filter for DualStandardFilter

source§

const FILTER_TYPE: FilterType = FilterType::Dual

The type of the filter.
source§

fn to_registers(&self) -> [u8; 8]

Get the register level representation of the filter.
source§

fn filter_type(&self) -> FilterType

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.