Skip to content

Commit 3fc7933

Browse files
committed
Make delay traits fallible
1 parent 0036746 commit 3fc7933

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/blocking/delay.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,21 @@
1212
/// `UXX` denotes the range type of the delay time. `UXX` can be `u8`, `u16`, etc. A single type can
1313
/// implement this trait for different types of `UXX`.
1414
pub trait DelayMs<UXX> {
15+
/// Enumeration of `DelayMs` errors
16+
type Error;
17+
1518
/// Pauses execution for `ms` milliseconds
16-
fn delay_ms(&mut self, ms: UXX);
19+
fn try_delay_ms(&mut self, ms: UXX) -> Result<(), Self::Error>;
1720
}
1821

1922
/// Microsecond delay
2023
///
2124
/// `UXX` denotes the range type of the delay time. `UXX` can be `u8`, `u16`, etc. A single type can
2225
/// implement this trait for different types of `UXX`.
2326
pub trait DelayUs<UXX> {
27+
/// Enumeration of `DelayMs` errors
28+
type Error;
29+
2430
/// Pauses execution for `us` microseconds
25-
fn delay_us(&mut self, us: UXX);
31+
fn try_delay_us(&mut self, us: UXX) -> Result<(), Self::Error>;
2632
}

0 commit comments

Comments
 (0)