cubecl_common/future.rs
1use core::future::Future;
2
3/// Block until the [future](Future) is completed and returns the result.
4pub fn block_on<O>(fut: impl Future<Output = O>) -> O {
5 #[cfg(target_family = "wasm")]
6 {
7 super::reader::read_sync(fut)
8 }
9
10 #[cfg(all(not(target_family = "wasm"), not(feature = "std")))]
11 {
12 embassy_futures::block_on(fut)
13 }
14
15 #[cfg(all(not(target_family = "wasm"), feature = "std"))]
16 {
17 futures_lite::future::block_on(fut)
18 }
19}