[embassy-net] Auto-documented feature flags

This commit is contained in:
Barnaby Walters 2023-12-22 23:20:43 +01:00
parent 87c03037e3
commit d63590cb61
2 changed files with 20 additions and 0 deletions

View file

@ -25,18 +25,34 @@ features = ["defmt", "tcp", "udp", "dns", "dhcpv4", "proto-ipv6", "medium-ethern
default = [] default = []
std = [] std = []
## Enable defmt
defmt = ["dep:defmt", "smoltcp/defmt", "embassy-net-driver/defmt", "heapless/defmt-03"] defmt = ["dep:defmt", "smoltcp/defmt", "embassy-net-driver/defmt", "heapless/defmt-03"]
#! Many of the following feature flags are re-exports of smoltcp feature flags. See
#! the [smoltcp feature flag documentation](https://github.com/smoltcp-rs/smoltcp#feature-flags)
#! for more details
## Enable UDP support
udp = ["smoltcp/socket-udp"] udp = ["smoltcp/socket-udp"]
## Enable TCP support
tcp = ["smoltcp/socket-tcp"] tcp = ["smoltcp/socket-tcp"]
## Enable DNS support
dns = ["smoltcp/socket-dns", "smoltcp/proto-dns"] dns = ["smoltcp/socket-dns", "smoltcp/proto-dns"]
## Enable DHCPv4 support
dhcpv4 = ["proto-ipv4", "medium-ethernet", "smoltcp/socket-dhcpv4"] dhcpv4 = ["proto-ipv4", "medium-ethernet", "smoltcp/socket-dhcpv4"]
## Enable DHCPv4 support with hostname
dhcpv4-hostname = ["dhcpv4"] dhcpv4-hostname = ["dhcpv4"]
## Enable IPv4 support
proto-ipv4 = ["smoltcp/proto-ipv4"] proto-ipv4 = ["smoltcp/proto-ipv4"]
## Enable IPv6 support
proto-ipv6 = ["smoltcp/proto-ipv6"] proto-ipv6 = ["smoltcp/proto-ipv6"]
## Enable the Ethernet medium
medium-ethernet = ["smoltcp/medium-ethernet"] medium-ethernet = ["smoltcp/medium-ethernet"]
## Enable the IP medium
medium-ip = ["smoltcp/medium-ip"] medium-ip = ["smoltcp/medium-ip"]
## Enable the IEEE 802.15.4 medium
medium-ieee802154 = ["smoltcp/medium-ieee802154"] medium-ieee802154 = ["smoltcp/medium-ieee802154"]
## Enable IGMP support
igmp = ["smoltcp/proto-igmp"] igmp = ["smoltcp/proto-igmp"]
[dependencies] [dependencies]
@ -62,3 +78,4 @@ stable_deref_trait = { version = "1.2.0", default-features = false }
futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] } futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] }
atomic-pool = "1.0" atomic-pool = "1.0"
embedded-nal-async = { version = "0.7.1" } embedded-nal-async = { version = "0.7.1" }
document-features = "0.2.7"

View file

@ -5,6 +5,9 @@
#![warn(missing_docs)] #![warn(missing_docs)]
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
//! ## Feature flags
#![doc = document_features::document_features!(feature_label = r#"<span class="stab portability"><code>{feature}</code></span>"#)]
#[cfg(not(any(feature = "proto-ipv4", feature = "proto-ipv6")))] #[cfg(not(any(feature = "proto-ipv4", feature = "proto-ipv6")))]
compile_error!("You must enable at least one of the following features: proto-ipv4, proto-ipv6"); compile_error!("You must enable at least one of the following features: proto-ipv4, proto-ipv6");