diff options
| author | Ruben De Smet <[email protected]> | 2023-06-07 12:08:53 +0200 |
|---|---|---|
| committer | Ruben De Smet <[email protected]> | 2023-06-07 13:18:19 +0200 |
| commit | 2455fd4dbe4e874a9a200d3026f66d437449b04d (patch) | |
| tree | a23619aeb2d6c028e57d925db20bd19f7ded6e9d /embassy-net/src/lib.rs | |
| parent | 352f0b6c3823797576c36f417d6be40189bca5d5 (diff) | |
net: Add documentation to new Config system
Diffstat (limited to 'embassy-net/src/lib.rs')
| -rw-r--r-- | embassy-net/src/lib.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs index cf7ebad3f..7e8f765f9 100644 --- a/embassy-net/src/lib.rs +++ b/embassy-net/src/lib.rs | |||
| @@ -128,13 +128,16 @@ impl Default for DhcpConfig { | |||
| 128 | 128 | ||
| 129 | /// Network stack configuration. | 129 | /// Network stack configuration. |
| 130 | pub struct Config { | 130 | pub struct Config { |
| 131 | /// IPv4 configuration | ||
| 131 | #[cfg(feature = "proto-ipv4")] | 132 | #[cfg(feature = "proto-ipv4")] |
| 132 | pub ipv4: ConfigV4, | 133 | pub ipv4: ConfigV4, |
| 134 | /// IPv6 configuration | ||
| 133 | #[cfg(feature = "proto-ipv6")] | 135 | #[cfg(feature = "proto-ipv6")] |
| 134 | pub ipv6: ConfigV6, | 136 | pub ipv6: ConfigV6, |
| 135 | } | 137 | } |
| 136 | 138 | ||
| 137 | impl Config { | 139 | impl Config { |
| 140 | /// IPv4 configuration with static addressing. | ||
| 138 | #[cfg(feature = "proto-ipv4")] | 141 | #[cfg(feature = "proto-ipv4")] |
| 139 | pub fn ipv4_static(config: StaticConfigV4) -> Self { | 142 | pub fn ipv4_static(config: StaticConfigV4) -> Self { |
| 140 | Self { | 143 | Self { |
| @@ -144,6 +147,7 @@ impl Config { | |||
| 144 | } | 147 | } |
| 145 | } | 148 | } |
| 146 | 149 | ||
| 150 | /// IPv6 configuration with static addressing. | ||
| 147 | #[cfg(feature = "proto-ipv6")] | 151 | #[cfg(feature = "proto-ipv6")] |
| 148 | pub fn ipv6_static(config: StaticConfigV6) -> Self { | 152 | pub fn ipv6_static(config: StaticConfigV6) -> Self { |
| 149 | Self { | 153 | Self { |
| @@ -153,6 +157,12 @@ impl Config { | |||
| 153 | } | 157 | } |
| 154 | } | 158 | } |
| 155 | 159 | ||
| 160 | /// IPv6 configuration with dynamic addressing. | ||
| 161 | /// | ||
| 162 | /// # Example | ||
| 163 | /// ```rust | ||
| 164 | /// let _cfg = Config::dhcpv4(Default::default()); | ||
| 165 | /// ``` | ||
| 156 | #[cfg(feature = "dhcpv4")] | 166 | #[cfg(feature = "dhcpv4")] |
| 157 | pub fn dhcpv4(config: DhcpConfig) -> Self { | 167 | pub fn dhcpv4(config: DhcpConfig) -> Self { |
| 158 | Self { | 168 | Self { |
