Skip to content

Commit 0358624

Browse files
committed
Remove ability to create AlreadyCancled instance
1 parent accd109 commit 0358624

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
4646
which resulted into the situtation, that BSD 0-clause was not affectivly
4747
0-clause as MIT conditions had to be met anyways. (🧂 IANAL). ([#309])
4848
- Renamed `Serial::raw_read` to `Serial::read_data_register`. ([#281])
49+
- Timer error type `AlreadyCancled` is no longer public constructable. ([#281])
4950
- Move ADC from a macro to a generic implementation, meaning that
5051
it is possible to obtain an ADC instance via `Adc::new` instead of
5152
`Adc::adc1`. ([#281])

src/timer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ where
294294
/// Error if a [`Cancel`]-ble [`Timer`] was cancled already or never been started.
295295
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
296296
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
297-
pub struct AlreadyCancled;
297+
pub struct AlreadyCancled(pub(crate) ());
298298

299299
impl<TIM> Cancel for Timer<TIM>
300300
where
@@ -304,7 +304,7 @@ where
304304
fn cancel(&mut self) -> Result<(), Self::Error> {
305305
// If timer is already stopped.
306306
if !self.tim.is_cr1_cen_set() {
307-
return Err(AlreadyCancled);
307+
return Err(AlreadyCancled(()));
308308
}
309309
self.stop();
310310
Ok(())

0 commit comments

Comments
 (0)