Skip to content

Commit d7da223

Browse files
authored
Remove Toggle enum (#354)
1 parent 5198f0d commit d7da223

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2222
- Deprecate `Toggle` enum and use `Switch` instead for better naming purposes
2323
([#334])
2424
- Add `impl From<Toggle> for Switch` to reduce churn.
25+
- Remove `Toggle` enum and use `Switch` instead for better naming purposes
2526
- Fix undefined behavior in SPI implementation ([#346])
2627
- Add `num_traits::PrimInt` bounds to `Word`
2728
- Remove `Serial::split`, which possibly creates two mutable references two

src/lib.rs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -270,46 +270,21 @@ cfg_if! {
270270
}
271271
}
272272

273-
/// Toggle something on or off.
274-
///
275-
/// Convenience enum and wrapper around a bool, which more explicit about the intention to enable
276-
/// or disable something, in comparison to `true` or `false`.
277-
// TODO: Maybe move to some mod like "util"?
278-
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
279-
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
280-
#[deprecated(since = "0.10.0", note = "Use Switch instead")]
281-
#[allow(deprecated)]
282-
pub enum Toggle {
283-
/// Toggle something on / enable a thing.
284-
On,
285-
/// Toggle something off / disable a thing.
286-
Off,
287-
}
288-
289273
/// Switch something on or off.
290274
///
291275
/// Convenience enum and wrapper around a bool, which more explicit about the intention to enable
292276
/// or disable something, in comparison to `true` or `false`.
293277
// TODO: Maybe move to some mod like "util"?
294278
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
295279
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
280+
#[doc(alias = "Toggle")]
296281
pub enum Switch {
297282
/// Switch something on / enable a thing.
298283
On,
299284
/// Switch something off / disable a thing.
300285
Off,
301286
}
302287

303-
#[allow(deprecated)]
304-
impl From<Toggle> for Switch {
305-
fn from(toggle: Toggle) -> Self {
306-
match toggle {
307-
Toggle::On => Switch::On,
308-
Toggle::Off => Switch::Off,
309-
}
310-
}
311-
}
312-
313288
impl From<Switch> for bool {
314289
fn from(switch: Switch) -> Self {
315290
matches!(switch, Switch::On)

0 commit comments

Comments
 (0)