This library allows Controller Area Network (CAN) communications on Linux using the SocketCAN interfaces. This provides a network socket interface to the CAN bus.
Please see the documentation for details about the Rust API provided by this library.
Version 2.x is finally released!
CanAddr
pulic and added functions to help interact with low-level sockaddr types. Sockets can now be opened with an address.Error
directly from a CanErrorFrame
or std::io::ErrorKind
.CanErrorFrame::new()
now works.CanErrorFrame::new_error()
is similar but more intuitive using a raw ID word.From<CanError> for CanErrorFrame
to create an error frame from a CanError
.Frame::from_raw_id()
and Frame::remote_from_raw_id()
The v2.0 release is a fairly large rewrite of the library and adds the following features:
std::error::Error
CanDataFrame
, CanRemoteFrame
, CanErrorFrame
, and CanFdFrame
CanFrame
for the classic 2.0 frames and CanAnyFrame
for any type of frame including the larger FD framesA number of items did not make it into the 2.0 release. These will be added in a follow-up v2.1, coming soon.
We will also start looking into support of Rust async/await, prefereably in a portable way without lying on a particular library/executor. But certainly support for the main ones like Tokio would be the goal. Some folks have suggested putting this into a separate wrapper crate, but it would be better to add it here for convenience, but certainly made optional through a Cargo build feature.
The current version of the crate targets Rust Edition 2021 with an MSRV of Rust v1.65.
Note that, at this time, the MSRV is mostly diven by use of the clap v4.0
crate for managing command-line parameters in the utilities and example applications. The core library could likely be built with an earlier version of the compiler if required.