
This reverts commit 53d387f340
.
# Objective
Reverts #6448. This didn't have the intended effect: we're now getting bevy::prelude shown in the docs again.
Co-authored-by: Alejandro Pascual <alejandro.pascual.pozo@gmail.com>
51 lines
1.3 KiB
Rust
51 lines
1.3 KiB
Rust
#![warn(missing_docs)]
|
|
#![doc = include_str!("../README.md")]
|
|
|
|
mod slice;
|
|
pub use slice::{ParallelSlice, ParallelSliceMut};
|
|
|
|
mod task;
|
|
pub use task::Task;
|
|
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
mod task_pool;
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
pub use task_pool::{Scope, TaskPool, TaskPoolBuilder};
|
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
mod single_threaded_task_pool;
|
|
#[cfg(target_arch = "wasm32")]
|
|
pub use single_threaded_task_pool::{Scope, TaskPool, TaskPoolBuilder};
|
|
|
|
mod usages;
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
pub use usages::tick_global_task_pools_on_main_thread;
|
|
pub use usages::{AsyncComputeTaskPool, ComputeTaskPool, IoTaskPool};
|
|
|
|
mod iter;
|
|
pub use iter::ParallelIterator;
|
|
|
|
#[allow(missing_docs)]
|
|
pub mod prelude {
|
|
#[doc(hidden)]
|
|
pub use crate::{
|
|
iter::ParallelIterator,
|
|
slice::{ParallelSlice, ParallelSliceMut},
|
|
usages::{AsyncComputeTaskPool, ComputeTaskPool, IoTaskPool},
|
|
};
|
|
}
|
|
|
|
use std::num::NonZeroUsize;
|
|
|
|
/// Gets the logical CPU core count available to the current process.
|
|
///
|
|
/// This is identical to [`std::thread::available_parallelism`], except
|
|
/// it will return a default value of 1 if it internally errors out.
|
|
///
|
|
/// This will always return at least 1.
|
|
pub fn available_parallelism() -> usize {
|
|
std::thread::available_parallelism()
|
|
.map(NonZeroUsize::get)
|
|
.unwrap_or(1)
|
|
}
|