Crate tokio_socketcan[−][src]
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_util::stream::StreamExt;
use tokio_socketcan::{CANSocket, Error};
#[tokio::main]
async fn main() -> Result<(), Error> {
let mut socket_rx = CANSocket::open("vcan0")?;
let socket_tx = CANSocket::open("vcan0")?;
while let Some(Ok(frame)) = socket_rx.next().await {
socket_tx.write_frame(frame)?.await;
}
Ok(())
}
Structs
CANFilter
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