fix tests

This commit is contained in:
Greg Johnston 2024-06-21 11:17:54 -04:00
parent 81c0947ce5
commit 4323e30133
1 changed files with 8 additions and 10 deletions

View File

@ -14,14 +14,15 @@
//! ```rust //! ```rust
//! use any_spawner::Executor; //! use any_spawner::Executor;
//! //!
//! Executor::init_futures_executor() //! // make sure an Executor has been initialized with one of the init_ functions
//! .expect("executor should only be initialized once");
//! //!
//! # if false {
//! // spawn a thread-safe Future //! // spawn a thread-safe Future
//! Executor::spawn(async { /* ... */ }); //! Executor::spawn(async { /* ... */ });
//! //!
//! // spawn a Future that is !Send //! // spawn a Future that is !Send
//! Executor::spawn_local(async { /* ... */ }); //! Executor::spawn_local(async { /* ... */ });
//! # }
//! ``` //! ```
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
@ -51,12 +52,10 @@ impl Executor {
/// Spawns a thread-safe [`Future`]. /// Spawns a thread-safe [`Future`].
/// ```rust /// ```rust
/// use any_spawner::Executor; /// use any_spawner::Executor;
/// /// # if false {
/// Executor::init_futures_executor()
/// .expect("executor should only be initialized once");
///
/// // spawn a thread-safe Future /// // spawn a thread-safe Future
/// Executor::spawn(async { /* ... */ }); /// Executor::spawn(async { /* ... */ });
/// # }
/// ``` /// ```
#[track_caller] #[track_caller]
pub fn spawn(fut: impl Future<Output = ()> + Send + 'static) { pub fn spawn(fut: impl Future<Output = ()> + Send + 'static) {
@ -82,11 +81,10 @@ impl Executor {
/// ```rust /// ```rust
/// use any_spawner::Executor; /// use any_spawner::Executor;
/// ///
/// Executor::init_futures_executor() /// # if false {
/// .expect("executor should only be initialized once");
///
/// // spawn a thread-safe Future /// // spawn a thread-safe Future
/// Executor::spawn(async { /* ... */ }); /// Executor::spawn_local(async { /* ... */ });
/// # }
/// ``` /// ```
#[track_caller] #[track_caller]
pub fn spawn_local(fut: impl Future<Output = ()> + 'static) { pub fn spawn_local(fut: impl Future<Output = ()> + 'static) {