diff options
| author | Caleb Jamison <[email protected]> | 2024-01-31 16:26:11 -0500 |
|---|---|---|
| committer | Caleb Jamison <[email protected]> | 2024-01-31 16:26:11 -0500 |
| commit | 8b7d85619537fc20ad7ad533433d84ba4975ddc4 (patch) | |
| tree | 9ec05b932f1bcfb9d4d4f768654637320bb87b44 /embassy-time/src | |
| parent | 1e698af05bc6e7e520d3f35ef661f34ea6ea359e (diff) | |
Rename timeout_at to with_deadline
Diffstat (limited to 'embassy-time/src')
| -rw-r--r-- | embassy-time/src/lib.rs | 2 | ||||
| -rw-r--r-- | embassy-time/src/timer.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/embassy-time/src/lib.rs b/embassy-time/src/lib.rs index e7efce49c..3c8575ee9 100644 --- a/embassy-time/src/lib.rs +++ b/embassy-time/src/lib.rs | |||
| @@ -32,7 +32,7 @@ pub use delay::{block_for, Delay}; | |||
| 32 | pub use duration::Duration; | 32 | pub use duration::Duration; |
| 33 | pub use embassy_time_driver::TICK_HZ; | 33 | pub use embassy_time_driver::TICK_HZ; |
| 34 | pub use instant::Instant; | 34 | pub use instant::Instant; |
| 35 | pub use timer::{timeout_at, with_timeout, Ticker, TimeoutError, Timer}; | 35 | pub use timer::{with_deadline, with_timeout, Ticker, TimeoutError, Timer}; |
| 36 | 36 | ||
| 37 | const fn gcd(a: u64, b: u64) -> u64 { | 37 | const fn gcd(a: u64, b: u64) -> u64 { |
| 38 | if b == 0 { | 38 | if b == 0 { |
diff --git a/embassy-time/src/timer.rs b/embassy-time/src/timer.rs index dbce9297c..bcd6bf4f7 100644 --- a/embassy-time/src/timer.rs +++ b/embassy-time/src/timer.rs | |||
| @@ -30,7 +30,7 @@ pub async fn with_timeout<F: Future>(timeout: Duration, fut: F) -> Result<F::Out | |||
| 30 | /// | 30 | /// |
| 31 | /// If the future completes before the deadline, its output is returned. Otherwise, on timeout, | 31 | /// If the future completes before the deadline, its output is returned. Otherwise, on timeout, |
| 32 | /// work on the future is stopped (`poll` is no longer called), the future is dropped and `Err(TimeoutError)` is returned. | 32 | /// work on the future is stopped (`poll` is no longer called), the future is dropped and `Err(TimeoutError)` is returned. |
| 33 | pub async fn timeout_at<F: Future>(at: Instant, fut: F) -> Result<F::Output, TimeoutError> { | 33 | pub async fn with_deadline<F: Future>(at: Instant, fut: F) -> Result<F::Output, TimeoutError> { |
| 34 | let timeout_fut = Timer::at(at); | 34 | let timeout_fut = Timer::at(at); |
| 35 | pin_mut!(fut); | 35 | pin_mut!(fut); |
| 36 | match select(fut, timeout_fut).await { | 36 | match select(fut, timeout_fut).await { |
