diff options
| author | Barnaby Walters <[email protected]> | 2023-12-22 23:20:43 +0100 |
|---|---|---|
| committer | Barnaby Walters <[email protected]> | 2023-12-22 23:20:43 +0100 |
| commit | d63590cb61e0fb9164996677be790c4213ef4a9e (patch) | |
| tree | f98887f771284018f0c5c5db496e14b646e86205 | |
| parent | 87c03037e320ce30c0cd34fe97e0365e1b11aa9a (diff) | |
[embassy-net] Auto-documented feature flags
| -rw-r--r-- | embassy-net/Cargo.toml | 17 | ||||
| -rw-r--r-- | embassy-net/src/lib.rs | 3 |
2 files changed, 20 insertions, 0 deletions
diff --git a/embassy-net/Cargo.toml b/embassy-net/Cargo.toml index 0c07e3651..e6c5ea74f 100644 --- a/embassy-net/Cargo.toml +++ b/embassy-net/Cargo.toml | |||
| @@ -25,18 +25,34 @@ features = ["defmt", "tcp", "udp", "dns", "dhcpv4", "proto-ipv6", "medium-ethern | |||
| 25 | default = [] | 25 | default = [] |
| 26 | std = [] | 26 | std = [] |
| 27 | 27 | ||
| 28 | ## Enable defmt | ||
| 28 | defmt = ["dep:defmt", "smoltcp/defmt", "embassy-net-driver/defmt", "heapless/defmt-03"] | 29 | defmt = ["dep:defmt", "smoltcp/defmt", "embassy-net-driver/defmt", "heapless/defmt-03"] |
| 29 | 30 | ||
| 31 | #! Many of the following feature flags are re-exports of smoltcp feature flags. See | ||
| 32 | #! the [smoltcp feature flag documentation](https://github.com/smoltcp-rs/smoltcp#feature-flags) | ||
| 33 | #! for more details | ||
| 34 | |||
| 35 | ## Enable UDP support | ||
| 30 | udp = ["smoltcp/socket-udp"] | 36 | udp = ["smoltcp/socket-udp"] |
| 37 | ## Enable TCP support | ||
| 31 | tcp = ["smoltcp/socket-tcp"] | 38 | tcp = ["smoltcp/socket-tcp"] |
| 39 | ## Enable DNS support | ||
| 32 | dns = ["smoltcp/socket-dns", "smoltcp/proto-dns"] | 40 | dns = ["smoltcp/socket-dns", "smoltcp/proto-dns"] |
| 41 | ## Enable DHCPv4 support | ||
| 33 | dhcpv4 = ["proto-ipv4", "medium-ethernet", "smoltcp/socket-dhcpv4"] | 42 | dhcpv4 = ["proto-ipv4", "medium-ethernet", "smoltcp/socket-dhcpv4"] |
| 43 | ## Enable DHCPv4 support with hostname | ||
| 34 | dhcpv4-hostname = ["dhcpv4"] | 44 | dhcpv4-hostname = ["dhcpv4"] |
| 45 | ## Enable IPv4 support | ||
| 35 | proto-ipv4 = ["smoltcp/proto-ipv4"] | 46 | proto-ipv4 = ["smoltcp/proto-ipv4"] |
| 47 | ## Enable IPv6 support | ||
| 36 | proto-ipv6 = ["smoltcp/proto-ipv6"] | 48 | proto-ipv6 = ["smoltcp/proto-ipv6"] |
| 49 | ## Enable the Ethernet medium | ||
| 37 | medium-ethernet = ["smoltcp/medium-ethernet"] | 50 | medium-ethernet = ["smoltcp/medium-ethernet"] |
| 51 | ## Enable the IP medium | ||
| 38 | medium-ip = ["smoltcp/medium-ip"] | 52 | medium-ip = ["smoltcp/medium-ip"] |
| 53 | ## Enable the IEEE 802.15.4 medium | ||
| 39 | medium-ieee802154 = ["smoltcp/medium-ieee802154"] | 54 | medium-ieee802154 = ["smoltcp/medium-ieee802154"] |
| 55 | ## Enable IGMP support | ||
| 40 | igmp = ["smoltcp/proto-igmp"] | 56 | igmp = ["smoltcp/proto-igmp"] |
| 41 | 57 | ||
| 42 | [dependencies] | 58 | [dependencies] |
| @@ -62,3 +78,4 @@ stable_deref_trait = { version = "1.2.0", default-features = false } | |||
| 62 | futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] } | 78 | futures = { version = "0.3.17", default-features = false, features = [ "async-await" ] } |
| 63 | atomic-pool = "1.0" | 79 | atomic-pool = "1.0" |
| 64 | embedded-nal-async = { version = "0.7.1" } | 80 | embedded-nal-async = { version = "0.7.1" } |
| 81 | document-features = "0.2.7" | ||
diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs index d970d0332..2cef2232c 100644 --- a/embassy-net/src/lib.rs +++ b/embassy-net/src/lib.rs | |||
| @@ -5,6 +5,9 @@ | |||
| 5 | #![warn(missing_docs)] | 5 | #![warn(missing_docs)] |
| 6 | #![doc = include_str!("../README.md")] | 6 | #![doc = include_str!("../README.md")] |
| 7 | 7 | ||
| 8 | //! ## Feature flags | ||
| 9 | #![doc = document_features::document_features!(feature_label = r#"<span class="stab portability"><code>{feature}</code></span>"#)] | ||
| 10 | |||
| 8 | #[cfg(not(any(feature = "proto-ipv4", feature = "proto-ipv6")))] | 11 | #[cfg(not(any(feature = "proto-ipv4", feature = "proto-ipv6")))] |
| 9 | compile_error!("You must enable at least one of the following features: proto-ipv4, proto-ipv6"); | 12 | compile_error!("You must enable at least one of the following features: proto-ipv4, proto-ipv6"); |
| 10 | 13 | ||
