embedded_hal_can

Trait Filter

Source
pub trait Filter {
    type Id: Id;

    // Required methods
    fn from_id(id: Self::Id) -> Self;
    fn accept_all() -> Self;
    fn from_mask(mask: u32, filter: u32) -> Self;
}
Expand description

A type that will either accept or filter a Frame. The filtering is done solely on the ID of the Frame.

Required Associated Types§

Source

type Id: Id

The Id type this filter works on

Required Methods§

Source

fn from_id(id: Self::Id) -> Self

Constructs a filter that only accepts Frames with the provided identifier.

Source

fn accept_all() -> Self

Constructs a filter that will accept any Frame.

Source

fn from_mask(mask: u32, filter: u32) -> Self

Create a Filter from a filter/mask combination.

  • Bit 0..11 is used when matching against base id
  • Bit 0..29 is used when matching against extended_id
  • Bit 29 matches the extended frame flag (can be used for only matching against base/extended ids)
  • Bit 30..32 must be 0

Note: When filtering base id any rule put on bit_pos >= 11 will (for implementers: must) be ignored

§Panic

(for implementers: must) panic if mask have bits equal to 1 for bit_position >= 30.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§