Skip to content

Commit

Permalink
Hid the 'can' utility build behind a 'utils' feature flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
fpagliughi committed Feb 20, 2022
1 parent 04307f6 commit c32ceba
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
16 changes: 14 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,29 @@ name = "socketcan"
repository = "https://github.com/mbr/socketcan-rs"
version = "2.0.0"

# Features:
#
# "netlink" (default) - Whether to include CAN interface configuration
# capabilities based on netlink kernel communications
# "utils" - Build command-line utilities
#

[features]
default = ["netlink"]
netlink = ["neli"]
vcan_tests = ["netlink"]
utils = ["clap", "anyhow"]

[dependencies]
byte_conv = "0.1.1"
hex = "0.4"
itertools = "0.10"
libc = "0.2"
nix = "0.23"
clap = "2.33"
anyhow = "1.0"
clap = { version = "2.33", optional = true }
anyhow = { version = "1.0", optional = true }
neli = { version = "0.6", optional = true }

[[bin]]
name = "can"
required-features = ["utils"]
19 changes: 18 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! SocketCAN support.
//!
//! The Linux kernel supports using CAN-devices through a network-like API
//! (see https://www.kernel.org/doc/Documentation/networking/can.txt). This
//! (see <https://www.kernel.org/doc/Documentation/networking/can.txt>). This
//! crate allows easy access to this functionality without having to wrestle
//! libc calls.
//!
Expand Down Expand Up @@ -40,6 +40,23 @@
//! Raw access to the underlying file descriptor and construction through
//! is available through the `AsRawFd`, `IntoRawFd` and `FromRawFd`
//! implementations.
//!
//! # Crate Features
//!
//! ### Default
//!
//! * **netlink** -
//! Whether to include programmable CAN interface configuration capabilities
//! based on netlink kernel communications. This brings in the
//! [neli](https://docs.rs/neli/latest/neli/) library and its dependencies.
//!
//! ### Non-default
//!
//! * **utils** -
//! Whether to build command-line utilities. This brings in additional
//! dependencies like [anyhow](https://docs.rs/anyhow/latest/anyhow/) and
//! [clap](https://docs.rs/clap/latest/clap/)
//!

// clippy: do not warn about things like "SocketCAN" inside the docs
#![cfg_attr(feature = "cargo-clippy", allow(doc_markdown))]
Expand Down

0 comments on commit c32ceba

Please sign in to comment.