mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
runtime: remove unneeded #[cfg(feature = "rt")] (#2996)
This commit is contained in:
parent
2696794771
commit
c793ead0c3
@ -287,7 +287,6 @@ cfg_rt! {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum Kind {
|
enum Kind {
|
||||||
/// Execute all tasks on the current-thread.
|
/// Execute all tasks on the current-thread.
|
||||||
#[cfg(feature = "rt")]
|
|
||||||
CurrentThread(BasicScheduler<driver::Driver>),
|
CurrentThread(BasicScheduler<driver::Driver>),
|
||||||
|
|
||||||
/// Execute tasks across multiple threads.
|
/// Execute tasks across multiple threads.
|
||||||
@ -359,7 +358,6 @@ cfg_rt! {
|
|||||||
/// });
|
/// });
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
#[cfg(feature = "rt")]
|
|
||||||
pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
|
pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
|
||||||
where
|
where
|
||||||
F: Future + Send + 'static,
|
F: Future + Send + 'static,
|
||||||
@ -388,7 +386,6 @@ cfg_rt! {
|
|||||||
/// println!("now running on a worker thread");
|
/// println!("now running on a worker thread");
|
||||||
/// });
|
/// });
|
||||||
/// # }
|
/// # }
|
||||||
#[cfg(feature = "rt")]
|
|
||||||
pub fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R>
|
pub fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R>
|
||||||
where
|
where
|
||||||
F: FnOnce() -> R + Send + 'static,
|
F: FnOnce() -> R + Send + 'static,
|
||||||
@ -443,7 +440,6 @@ cfg_rt! {
|
|||||||
let _enter = self.enter();
|
let _enter = self.enter();
|
||||||
|
|
||||||
match &self.kind {
|
match &self.kind {
|
||||||
#[cfg(feature = "rt")]
|
|
||||||
Kind::CurrentThread(exec) => exec.block_on(future),
|
Kind::CurrentThread(exec) => exec.block_on(future),
|
||||||
#[cfg(feature = "rt-multi-thread")]
|
#[cfg(feature = "rt-multi-thread")]
|
||||||
Kind::ThreadPool(exec) => exec.block_on(future),
|
Kind::ThreadPool(exec) => exec.block_on(future),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user