Crate tokio_socketcan

source ·
Expand description

tokio-socketcan

Connective plumbing between the socketcan crate and the tokio asynchronous I/O system

Usage

The socketcan crate’s documentation is valuable as the api used by tokio-socketcan is largely identical to the socketcan one.

An example echo server:

use futures::stream::Stream;
use futures::future::{self, Future};

let socket_rx = tokio_socketcan::CANSocket::open("vcan0").unwrap();
let socket_tx = tokio_socketcan::CANSocket::open("vcan0").unwrap();

tokio::run(socket_rx.for_each(move |frame| {
    socket_tx.write_frame(frame)
}).map_err(|_err| {}));

Structs

CANFrame
An asynchronous I/O wrapped socketcan::CANSocket
A Future representing the eventual writing of a CANFrame to the socket
A socketcan::CANSocket wrapped for mio eventing to allow it be integrated in turn into tokio

Enums

Errors opening socket