bevy/crates/bevy_tasks/src/usages.rs
Michael Dorst b32770d303 Fix doc_markdown lints in bevy_tasks (#3481)
#3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time.

This PR fixes lints in the `bevy_tasks` crate.
2021-12-29 17:38:13 +00:00

53 lines
1.7 KiB
Rust

//! Definitions for a few common task pools that we want. Generally the determining factor for what
//! kind of work should go in each pool is latency requirements.
//!
//! For CPU-intensive work (tasks that generally spin until completion) we have a standard
//! [`ComputeTaskPool`] and an [`AsyncComputeTaskPool`]. Work that does not need to be completed to
//! present the next frame should go to the [`AsyncComputeTaskPool`]
//!
//! For IO-intensive work (tasks that spend very little time in a "woken" state) we have an IO
//! task pool. The tasks here are expected to complete very quickly. Generally they should just
//! await receiving data from somewhere (i.e. disk) and signal other systems when the data is ready
//! for consumption. (likely via channels)
use super::TaskPool;
use std::ops::Deref;
/// A newtype for a task pool for CPU-intensive work that must be completed to deliver the next
/// frame
#[derive(Clone, Debug)]
pub struct ComputeTaskPool(pub TaskPool);
impl Deref for ComputeTaskPool {
type Target = TaskPool;
fn deref(&self) -> &Self::Target {
&self.0
}
}
/// A newtype for a task pool for CPU-intensive work that may span across multiple frames
#[derive(Clone, Debug)]
pub struct AsyncComputeTaskPool(pub TaskPool);
impl Deref for AsyncComputeTaskPool {
type Target = TaskPool;
fn deref(&self) -> &Self::Target {
&self.0
}
}
/// A newtype for a task pool for IO-intensive work (i.e. tasks that spend very little time in a
/// "woken" state)
#[derive(Clone, Debug)]
pub struct IoTaskPool(pub TaskPool);
impl Deref for IoTaskPool {
type Target = TaskPool;
fn deref(&self) -> &Self::Target {
&self.0
}
}