Merge #1248
1248: embassy-time: add async tick() method to Ticker r=Dirbaio a=kbleeke Small QOL change so you don't have to add a direct dependency on futures-util to use the Ticker Co-authored-by: kbleeke <pluth@0t.re>
This commit is contained in:
		
						commit
						d719f8bc03
					
				| @ -3,7 +3,7 @@ use core::pin::Pin; | ||||
| use core::task::{Context, Poll, Waker}; | ||||
| 
 | ||||
| use futures_util::future::{select, Either}; | ||||
| use futures_util::{pin_mut, Stream}; | ||||
| use futures_util::{pin_mut, Stream, StreamExt}; | ||||
| 
 | ||||
| use crate::{Duration, Instant}; | ||||
| 
 | ||||
| @ -132,6 +132,11 @@ impl Ticker { | ||||
|         let expires_at = Instant::now() + duration; | ||||
|         Self { expires_at, duration } | ||||
|     } | ||||
| 
 | ||||
|     /// Waits for the next tick
 | ||||
|     pub async fn next(&mut self) { | ||||
|         <Self as StreamExt>::next(self).await; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| impl Unpin for Ticker {} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user