From 098d582a0028d16f7c520f6d18a4cb308250862b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Fri, 29 Nov 2019 10:10:02 +0300 Subject: [PATCH] docs: Mention features for basic_scheduler, threaded_scheduler Fixes #1829 --- tokio/src/runtime/builder.rs | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/tokio/src/runtime/builder.rs b/tokio/src/runtime/builder.rs index b7f200e96c9..1b51379b402 100644 --- a/tokio/src/runtime/builder.rs +++ b/tokio/src/runtime/builder.rs @@ -152,23 +152,6 @@ impl Builder { self } - /// Use a simpler scheduler that runs all tasks on the current-thread. - /// - /// The executor and all necessary drivers will all be run on the current - /// thread during `block_on` calls. - #[cfg(feature = "rt-core")] - pub fn basic_scheduler(&mut self) -> &mut Self { - self.kind = Kind::Basic; - self - } - - /// Use a multi-threaded scheduler for executing tasks. - #[cfg(feature = "rt-threaded")] - pub fn threaded_scheduler(&mut self) -> &mut Self { - self.kind = Kind::ThreadPool; - self - } - /// Set name of threads spawned by the `Runtime`'s thread pool. /// /// The default name is "tokio-runtime-worker". @@ -369,6 +352,15 @@ cfg_time! { cfg_rt_core! { impl Builder { + /// Use a simpler scheduler that runs all tasks on the current-thread. + /// + /// The executor and all necessary drivers will all be run on the current + /// thread during `block_on` calls. + pub fn basic_scheduler(&mut self) -> &mut Self { + self.kind = Kind::Basic; + self + } + fn build_basic_runtime(&mut self) -> io::Result { use crate::runtime::{BasicScheduler, Kind}; @@ -407,6 +399,12 @@ cfg_rt_core! { cfg_rt_threaded! { impl Builder { + /// Use a multi-threaded scheduler for executing tasks. + pub fn threaded_scheduler(&mut self) -> &mut Self { + self.kind = Kind::ThreadPool; + self + } + fn build_threaded_runtime(&mut self) -> io::Result { use crate::runtime::{Kind, ThreadPool}; use crate::runtime::park::Parker;