pub struct Filter { /* private fields */ }Expand description
A frame a node keeps: one whose identifier, masked, equals the filter’s, and whose width, standard or extended, is the filter’s.
This is the SocketCAN filter, received_id & mask == id & mask, with the frame format
always part of the match, so a filter for an extended identifier never passes a standard
frame that happens to share its low bits.
§Examples
use pamoja_can::bus::Filter;
use pamoja_can::{CanId, J1939Id};
// Engine speed, parameter group 61444, from any engine controller at any priority.
let engine_speed = Filter::pgn(61_444);
assert!(engine_speed.matches(J1939Id::broadcast(3, 61_444, 0x00).to_id()));
assert!(engine_speed.matches(J1939Id::broadcast(6, 61_444, 0x01).to_id()));
assert!(!engine_speed.matches(J1939Id::broadcast(3, 61_443, 0x00).to_id()));
// One standard identifier and nothing else.
let motor = Filter::exact(CanId::standard(0x20A));
assert!(motor.matches(CanId::standard(0x20A)));
assert!(!motor.matches(CanId::extended(0x20A)));Implementations§
Trait Implementations§
impl Copy for Filter
impl Eq for Filter
impl StructuralPartialEq for Filter
Auto Trait Implementations§
impl Freeze for Filter
impl RefUnwindSafe for Filter
impl Send for Filter
impl Sync for Filter
impl Unpin for Filter
impl UnsafeUnpin for Filter
impl UnwindSafe for Filter
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