mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-10-02 06:40:47 +00:00
Mark various enums/structs as #[non_exhaustive]
(#3981)
* Mark various enums/structs as `#[non_exhaustive]` * Update `CHANGELOG.md`
This commit is contained in:
parent
6168d3487b
commit
4bfd7a28b6
@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- `esp-ieee802154` package has been folded into `esp-radio`, it's now alloc. (#3861, #3890)
|
- `esp-ieee802154` package has been folded into `esp-radio`, it's now alloc. (#3861, #3890)
|
||||||
- `ble`, `esp-now`, `csi`, `sniffer`, `esp-ieee802154` and `smoltcp` features and APIs marked as unstable (#3865)
|
- `ble`, `esp-now`, `csi`, `sniffer`, `esp-ieee802154` and `smoltcp` features and APIs marked as unstable (#3865)
|
||||||
- Update bt-hci version to add additional HCI commands (#3920)
|
- Update bt-hci version to add additional HCI commands (#3920)
|
||||||
|
- A number of enums/structs have been marked as `#[non_exhaustive]` (#3981)
|
||||||
|
- `AuthMethod`, `Protocol`, `AccessPointInfo`, `AccessPointConfiguration`, `ClientConfiguration`, `Capability`, `Configuration`, `WifiEvent`, `InternalWifiError`, `ScanTypeConfig`, and `WifiState`
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
@ -149,10 +149,10 @@ use crate::binary::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Supported Wi-Fi authentication methods.
|
/// Supported Wi-Fi authentication methods.
|
||||||
#[derive(EnumSetType, Debug, PartialOrd)]
|
#[derive(Debug, Default, PartialOrd, EnumSetType)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||||
#[derive(Default)]
|
#[non_exhaustive]
|
||||||
pub enum AuthMethod {
|
pub enum AuthMethod {
|
||||||
/// No authentication (open network).
|
/// No authentication (open network).
|
||||||
None,
|
None,
|
||||||
@ -184,10 +184,10 @@ pub enum AuthMethod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Supported Wi-Fi protocols.
|
/// Supported Wi-Fi protocols.
|
||||||
#[derive(EnumSetType, Debug, PartialOrd)]
|
#[derive(Debug, Default, PartialOrd, EnumSetType)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||||
#[derive(Default)]
|
#[non_exhaustive]
|
||||||
pub enum Protocol {
|
pub enum Protocol {
|
||||||
/// 802.11b protocol.
|
/// 802.11b protocol.
|
||||||
P802D11B,
|
P802D11B,
|
||||||
@ -274,6 +274,7 @@ impl defmt::Format for Country {
|
|||||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||||
|
#[non_exhaustive]
|
||||||
pub struct AccessPointInfo {
|
pub struct AccessPointInfo {
|
||||||
/// The SSID of the access point.
|
/// The SSID of the access point.
|
||||||
// TODO: we can use the `alloc` feature once we have `defmt` 1.0.2
|
// TODO: we can use the `alloc` feature once we have `defmt` 1.0.2
|
||||||
@ -302,6 +303,7 @@ pub struct AccessPointInfo {
|
|||||||
/// Configuration for a Wi-Fi access point.
|
/// Configuration for a Wi-Fi access point.
|
||||||
#[derive(Clone, PartialEq, Eq)]
|
#[derive(Clone, PartialEq, Eq)]
|
||||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||||
|
#[non_exhaustive]
|
||||||
pub struct AccessPointConfiguration {
|
pub struct AccessPointConfiguration {
|
||||||
/// The SSID of the access point.
|
/// The SSID of the access point.
|
||||||
pub ssid: String,
|
pub ssid: String,
|
||||||
@ -419,6 +421,7 @@ impl defmt::Format for AccessPointConfiguration {
|
|||||||
/// Client configuration for a Wi-Fi connection.
|
/// Client configuration for a Wi-Fi connection.
|
||||||
#[derive(Clone, PartialEq, Eq, Default)]
|
#[derive(Clone, PartialEq, Eq, Default)]
|
||||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||||
|
#[non_exhaustive]
|
||||||
pub struct ClientConfiguration {
|
pub struct ClientConfiguration {
|
||||||
/// The SSID of the Wi-Fi network.
|
/// The SSID of the Wi-Fi network.
|
||||||
pub ssid: String,
|
pub ssid: String,
|
||||||
@ -713,6 +716,7 @@ impl Default for EapClientConfiguration {
|
|||||||
#[derive(EnumSetType, Debug, PartialOrd)]
|
#[derive(EnumSetType, Debug, PartialOrd)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum Capability {
|
pub enum Capability {
|
||||||
/// The device operates as a client, connecting to an existing network.
|
/// The device operates as a client, connecting to an existing network.
|
||||||
Client,
|
Client,
|
||||||
@ -727,10 +731,11 @@ pub enum Capability {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Configuration of Wi-Fi operation mode.
|
/// Configuration of Wi-Fi operation mode.
|
||||||
|
#[allow(clippy::large_enum_variant)]
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Default)]
|
#[derive(Clone, Debug, PartialEq, Eq, Default)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||||
#[allow(clippy::large_enum_variant)]
|
#[non_exhaustive]
|
||||||
pub enum Configuration {
|
pub enum Configuration {
|
||||||
/// No configuration (default).
|
/// No configuration (default).
|
||||||
#[default]
|
#[default]
|
||||||
@ -1204,9 +1209,10 @@ pub enum WifiError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Events generated by the WiFi driver.
|
/// Events generated by the WiFi driver.
|
||||||
#[repr(i32)]
|
|
||||||
#[derive(Debug, FromPrimitive, EnumSetType)]
|
#[derive(Debug, FromPrimitive, EnumSetType)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
|
#[non_exhaustive]
|
||||||
|
#[repr(i32)]
|
||||||
pub enum WifiEvent {
|
pub enum WifiEvent {
|
||||||
/// Wi-Fi is ready for operation.
|
/// Wi-Fi is ready for operation.
|
||||||
WifiReady = 0,
|
WifiReady = 0,
|
||||||
@ -1311,9 +1317,10 @@ pub enum WifiEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Error originating from the underlying drivers
|
/// Error originating from the underlying drivers
|
||||||
#[repr(i32)]
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, FromPrimitive)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, FromPrimitive)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
|
#[non_exhaustive]
|
||||||
|
#[repr(i32)]
|
||||||
pub enum InternalWifiError {
|
pub enum InternalWifiError {
|
||||||
/// Out of memory
|
/// Out of memory
|
||||||
NoMem = 0x101,
|
NoMem = 0x101,
|
||||||
@ -1589,7 +1596,8 @@ pub(crate) fn wifi_start() -> Result<(), WifiError> {
|
|||||||
/// |--------------------------------------|------------|-------------|
|
/// |--------------------------------------|------------|-------------|
|
||||||
/// | **Power consumption** | High | Low |
|
/// | **Power consumption** | High | Low |
|
||||||
/// | **Time required (typical behavior)** | Low | High |
|
/// | **Time required (typical behavior)** | Low | High |
|
||||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum ScanTypeConfig {
|
pub enum ScanTypeConfig {
|
||||||
/// Active scan with min and max scan time per channel. This is the default
|
/// Active scan with min and max scan time per channel. This is the default
|
||||||
/// and recommended if you are unsure.
|
/// and recommended if you are unsure.
|
||||||
|
@ -8,6 +8,7 @@ use super::WifiEvent;
|
|||||||
#[atomic_enum]
|
#[atomic_enum]
|
||||||
#[derive(PartialEq, Debug)]
|
#[derive(PartialEq, Debug)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum WifiState {
|
pub enum WifiState {
|
||||||
/// Station started.
|
/// Station started.
|
||||||
StaStarted,
|
StaStarted,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user