tokio-socketcan 0.3.1

Asynchronous Linux SocketCAN sockets with tokio
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use futures_util::StreamExt;
use tokio;
use tokio_socketcan::CANSocket;

#[tokio::main]
async fn main() -> std::io::Result<()> {
    let mut socket_rx = CANSocket::open("vcan0").unwrap();

    println!("Reading on vcan0");

    while let Some(next) = socket_rx.next().await {
        println!("{:#?}", next);
    }

    Ok(())
}