From e89516ab85e808e4aa985762afd51745a93816a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Vi=C3=B6l?= Date: Tue, 28 Nov 2023 08:00:32 +0100 Subject: [PATCH] Remove Toggle enum --- CHANGELOG.md | 1 + src/lib.rs | 27 +-------------------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 939ecfb9..29db6135 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Deprecate `Toggle` enum and use `Switch` instead for better naming purposes ([#334]) - Add `impl From for Switch` to reduce churn. +- Remove `Toggle` enum and use `Switch` instead for better naming purposes - Fix undefined behavior in SPI implementation ([#346]) - Add `num_traits::PrimInt` bounds to `Word` - Remove `Serial::split`, which possibly creates two mutable references two diff --git a/src/lib.rs b/src/lib.rs index a581a3a7..63997311 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -270,22 +270,6 @@ cfg_if! { } } -/// Toggle something on or off. -/// -/// Convenience enum and wrapper around a bool, which more explicit about the intention to enable -/// or disable something, in comparison to `true` or `false`. -// TODO: Maybe move to some mod like "util"? -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] -#[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[deprecated(since = "0.10.0", note = "Use Switch instead")] -#[allow(deprecated)] -pub enum Toggle { - /// Toggle something on / enable a thing. - On, - /// Toggle something off / disable a thing. - Off, -} - /// Switch something on or off. /// /// Convenience enum and wrapper around a bool, which more explicit about the intention to enable @@ -293,6 +277,7 @@ pub enum Toggle { // TODO: Maybe move to some mod like "util"? #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] +#[doc(alias = "Toggle")] pub enum Switch { /// Switch something on / enable a thing. On, @@ -300,16 +285,6 @@ pub enum Switch { Off, } -#[allow(deprecated)] -impl From for Switch { - fn from(toggle: Toggle) -> Self { - match toggle { - Toggle::On => Switch::On, - Toggle::Off => Switch::Off, - } - } -} - impl From for bool { fn from(switch: Switch) -> Self { matches!(switch, Switch::On)