futures: move select* and join* to separate modules.

This commit is contained in:
Dario Nieuwenhuis 2022-08-28 22:57:35 +02:00
parent 2a0df652f3
commit 598689ef43
5 changed files with 13 additions and 10 deletions

View File

@ -1,3 +1,5 @@
//! Wait for multiple futures to complete.
use core::future::Future; use core::future::Future;
use core::pin::Pin; use core::pin::Pin;
use core::task::{Context, Poll}; use core::task::{Context, Poll};
@ -131,7 +133,7 @@ generate! {
/// ///
/// let a = async { 1 }; /// let a = async { 1 };
/// let b = async { 2 }; /// let b = async { 2 };
/// let pair = embassy_futures::join(a, b).await; /// let pair = embassy_futures::join::join(a, b).await;
/// ///
/// assert_eq!(pair, (1, 2)); /// assert_eq!(pair, (1, 2));
/// # }); /// # });
@ -160,7 +162,7 @@ where
/// let a = async { 1 }; /// let a = async { 1 };
/// let b = async { 2 }; /// let b = async { 2 };
/// let c = async { 3 }; /// let c = async { 3 };
/// let res = embassy_futures::join3(a, b, c).await; /// let res = embassy_futures::join::join3(a, b, c).await;
/// ///
/// assert_eq!(res, (1, 2, 3)); /// assert_eq!(res, (1, 2, 3));
/// # }); /// # });
@ -191,7 +193,7 @@ where
/// let b = async { 2 }; /// let b = async { 2 };
/// let c = async { 3 }; /// let c = async { 3 };
/// let d = async { 4 }; /// let d = async { 4 };
/// let res = embassy_futures::join4(a, b, c, d).await; /// let res = embassy_futures::join::join4(a, b, c, d).await;
/// ///
/// assert_eq!(res, (1, 2, 3, 4)); /// assert_eq!(res, (1, 2, 3, 4));
/// # }); /// # });
@ -229,7 +231,7 @@ where
/// let c = async { 3 }; /// let c = async { 3 };
/// let d = async { 4 }; /// let d = async { 4 };
/// let e = async { 5 }; /// let e = async { 5 };
/// let res = embassy_futures::join5(a, b, c, d, e).await; /// let res = embassy_futures::join::join5(a, b, c, d, e).await;
/// ///
/// assert_eq!(res, (1, 2, 3, 4, 5)); /// assert_eq!(res, (1, 2, 3, 4, 5));
/// # }); /// # });

View File

@ -6,11 +6,10 @@
pub(crate) mod fmt; pub(crate) mod fmt;
mod block_on; mod block_on;
mod join;
mod select;
mod yield_now; mod yield_now;
pub mod join;
pub mod select;
pub use block_on::*; pub use block_on::*;
pub use join::*;
pub use select::*;
pub use yield_now::*; pub use yield_now::*;

View File

@ -1,3 +1,5 @@
//! Wait for the first of several futures to complete.
use core::future::Future; use core::future::Future;
use core::pin::Pin; use core::pin::Pin;
use core::task::{Context, Poll}; use core::task::{Context, Poll};

View File

@ -12,7 +12,7 @@ mod descriptor_reader;
pub mod driver; pub mod driver;
pub mod types; pub mod types;
use embassy_futures::{select, Either}; use embassy_futures::select::{select, Either};
use heapless::Vec; use heapless::Vec;
pub use self::builder::{Builder, Config}; pub use self::builder::{Builder, Config};

View File

@ -8,7 +8,7 @@ use core::sync::atomic::{AtomicBool, Ordering};
use defmt::*; use defmt::*;
use embassy_executor::Spawner; use embassy_executor::Spawner;
use embassy_futures::{select, Either}; use embassy_futures::select::{select, Either};
use embassy_nrf::gpio::{Input, Pin, Pull}; use embassy_nrf::gpio::{Input, Pin, Pull};
use embassy_nrf::usb::{Driver, PowerUsb}; use embassy_nrf::usb::{Driver, PowerUsb};
use embassy_nrf::{interrupt, pac}; use embassy_nrf::{interrupt, pac};