Connection

Trait Connection 

Source
pub trait Connection: Send + Sync {
    // Required methods
    fn send(&self, packet: &Packet) -> Result<Packet>;
    fn iter(&self) -> Box<dyn Iterator<Item = Option<Packet>> + Send + Sync>;

    // Provided methods
    fn iter_until(
        &self,
        end: Instant,
    ) -> Box<dyn Iterator<Item = Packet> + Send + Sync> { ... }
    fn iter_for(
        &self,
        duration: Duration,
    ) -> Box<dyn Iterator<Item = Packet> + Send + Sync> { ... }
}

Required Methods§

Source

fn send(&self, packet: &Packet) -> Result<Packet>

Send packet on CAN adapter

Source

fn iter(&self) -> Box<dyn Iterator<Item = Option<Packet>> + Send + Sync>

read packets. Some(None) does not indicate end of iterator. Some(None) indicates that a poll() returned None.

Provided Methods§

Source

fn iter_until( &self, end: Instant, ) -> Box<dyn Iterator<Item = Packet> + Send + Sync>

Source

fn iter_for( &self, duration: Duration, ) -> Box<dyn Iterator<Item = Packet> + Send + Sync>

Trait Implementations§

Source§

impl IntoIterator for &dyn Connection

Source§

type Item = Option<Packet>

The type of the elements being iterated over.
Source§

type IntoIter = Box<dyn Iterator<Item = Option<Packet>> + Send + Sync>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl IntoIterator for &mut dyn Connection

Represents an adapter. This may be RP1210, SocketCAN, simulated or J2534 (eventually)

Source§

type Item = Option<Packet>

The type of the elements being iterated over.
Source§

type IntoIter = Box<dyn Iterator<Item = Option<Packet>> + Send + Sync>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Implementors§