id
stringlengths
22
133
text
stringlengths
40
40.2k
arch
stringclasses
1 value
syntax
stringclasses
1 value
kind
stringclasses
4 values
repo
stringclasses
27 values
path
stringlengths
5
116
license
stringclasses
6 values
commit
stringlengths
40
40
source_host
stringclasses
1 value
category
stringclasses
16 values
source_url
stringlengths
85
196
line_start
int64
1
4.28k
line_end
int64
4
4.31k
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
/// ``` /// /// # Panic /// /// This will panic if `val` is not larger than `0`. pub fn worker_threads(&mut self, val: usize) -> &mut Self { assert!(val > 0, "Worker threads cannot be set to 0"); self.worker_threads = Some(val); self } /// Specifies limit for threads...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b99b00eb302ae6ff19ca97d32b1e594143f43a60
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b99b00eb302ae6ff19ca97d32b1e594143f43a60/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:7
/// let rt = runtime::Builder::new_multi_thread() /// .thread_name("my-pool") /// .build(); /// # } /// ``` pub fn thread_name(&mut self, val: impl Into<String>) -> &mut Self { let val = val.into(); self.thread_name = std::sync::Arc::new(move || val.clone()); self ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b99b00eb302ae6ff19ca97d32b1e594143f43a60
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b99b00eb302ae6ff19ca97d32b1e594143f43a60/tokio/src/runtime/builder.rs
241
300
tokio-rs/tokio:tokio/src/runtime/builder.rs:9
/// ``` #[cfg(not(loom))] pub fn on_thread_start<F>(&mut self, f: F) -> &mut Self where F: Fn() + Send + Sync + 'static, { self.after_start = Some(std::sync::Arc::new(f)); self } /// Executes function `f` before each thread stops. /// /// This is intended for boo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b99b00eb302ae6ff19ca97d32b1e594143f43a60
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b99b00eb302ae6ff19ca97d32b1e594143f43a60/tokio/src/runtime/builder.rs
321
380
tokio-rs/tokio:tokio/src/runtime/builder.rs:10
/// # Examples /// /// ``` /// use tokio::runtime::Builder; /// /// let rt = Builder::new_multi_thread().build().unwrap(); /// /// rt.block_on(async { /// println!("Hello from the Tokio runtime"); /// }); /// ``` pub fn build(&mut self) -> io::Result<Runtime> { m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b99b00eb302ae6ff19ca97d32b1e594143f43a60
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b99b00eb302ae6ff19ca97d32b1e594143f43a60/tokio/src/runtime/builder.rs
361
420
tokio-rs/tokio:tokio/src/runtime/builder.rs:11
/// # use std::time::Duration; /// /// # pub fn main() { /// let rt = runtime::Builder::new_multi_thread() /// .thread_keep_alive(Duration::from_millis(100)) /// .build(); /// # } /// ``` pub fn thread_keep_alive(&mut self, duration: Duration) -> &mut Self { self.keep_ali...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b99b00eb302ae6ff19ca97d32b1e594143f43a60
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b99b00eb302ae6ff19ca97d32b1e594143f43a60/tokio/src/runtime/builder.rs
401
460
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
}) } } cfg_io_driver! { impl Builder { /// Enables the I/O driver. /// /// Doing this enables using net, process, signal, and some I/O types on /// the runtime. /// /// # Examples /// /// ``` /// use tokio::runtime; /// ///...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b99b00eb302ae6ff19ca97d32b1e594143f43a60
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b99b00eb302ae6ff19ca97d32b1e594143f43a60/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
/// .enable_time() /// .build() /// .unwrap(); /// ``` pub fn enable_time(&mut self) -> &mut Self { self.enable_time = true; self } } } cfg_rt_multi_thread! { impl Builder { fn build_threaded_runtime(&mut self) -> io::Result<Ru...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b99b00eb302ae6ff19ca97d32b1e594143f43a60
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b99b00eb302ae6ff19ca97d32b1e594143f43a60/tokio/src/runtime/builder.rs
481
540
tokio-rs/tokio:tokio/src/runtime/builder.rs:14
let _enter = crate::runtime::context::enter(handle.clone()); launch.launch(); Ok(Runtime { kind: Kind::ThreadPool(scheduler), handle, blocking_pool, }) } } } impl fmt::Debug for Builder { fn fmt(&self, fmt: &mut fmt::F...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b99b00eb302ae6ff19ca97d32b1e594143f43a60
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b99b00eb302ae6ff19ca97d32b1e594143f43a60/tokio/src/runtime/builder.rs
521
547
tokio-rs/tokio:tokio/src/runtime/builder.rs:2
/// Runtime type kind: Kind, /// Whether or not to enable the I/O driver enable_io: bool, /// Whether or not to enable the time driver enable_time: bool, /// The number of worker threads, used by Runtime. /// /// Only used when not using the current-thread executor. worker_threads...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
abd4c0025539f142ec48a09e01430f7ee3b83214
github
async-runtime
https://github.com/tokio-rs/tokio/blob/abd4c0025539f142ec48a09e01430f7ee3b83214/tokio/src/runtime/builder.rs
41
100
tokio-rs/tokio:tokio/src/runtime/builder.rs:3
impl Builder { /// Returns a new builder with the current thread scheduler selected. /// /// Configuration methods can be chained on the return value. pub fn new_current_thread() -> Builder { Builder::new(Kind::CurrentThread) } /// Returns a new builder with the multi thread scheduler s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
abd4c0025539f142ec48a09e01430f7ee3b83214
github
async-runtime
https://github.com/tokio-rs/tokio/blob/abd4c0025539f142ec48a09e01430f7ee3b83214/tokio/src/runtime/builder.rs
81
140
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
/// ``` /// /// # Panic /// /// This will panic if `val` is not larger than `0`. pub fn worker_threads(&mut self, val: usize) -> &mut Self { assert!(val > 0, "Worker threads cannot be set to 0"); self.worker_threads = Some(val); self } /// Specifies limit for threads...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
abd4c0025539f142ec48a09e01430f7ee3b83214
github
async-runtime
https://github.com/tokio-rs/tokio/blob/abd4c0025539f142ec48a09e01430f7ee3b83214/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:11
/// # use std::time::Duration; /// /// # pub fn main() { /// let rt = runtime::Builder::new_multi_thread() /// .thread_keep_alive(Duration::from_millis(100)) /// .build(); /// # } /// ``` pub fn thread_keep_alive(&mut self, duration: Duration) -> &mut Self { self.keep_ali...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
abd4c0025539f142ec48a09e01430f7ee3b83214
github
async-runtime
https://github.com/tokio-rs/tokio/blob/abd4c0025539f142ec48a09e01430f7ee3b83214/tokio/src/runtime/builder.rs
401
460
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
}) } } cfg_io_driver! { impl Builder { /// Enables the I/O driver. /// /// Doing this enables using net, process, signal, and some I/O types on /// the runtime. /// /// # Examples /// /// ``` /// use tokio::runtime; /// ///...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
abd4c0025539f142ec48a09e01430f7ee3b83214
github
async-runtime
https://github.com/tokio-rs/tokio/blob/abd4c0025539f142ec48a09e01430f7ee3b83214/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
/// .enable_time() /// .build() /// .unwrap(); /// ``` pub fn enable_time(&mut self) -> &mut Self { self.enable_time = true; self } } } cfg_rt_multi_thread! { impl Builder { fn build_threaded_runtime(&mut self) -> io::Result<Ru...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
abd4c0025539f142ec48a09e01430f7ee3b83214
github
async-runtime
https://github.com/tokio-rs/tokio/blob/abd4c0025539f142ec48a09e01430f7ee3b83214/tokio/src/runtime/builder.rs
481
540
tokio-rs/tokio:tokio/src/runtime/builder.rs:14
// Spawn the thread pool workers let _enter = crate::runtime::context::enter(handle.clone()); launch.launch(); Ok(Runtime { kind: Kind::ThreadPool(scheduler), handle, blocking_pool, }) } } } impl fmt::Debug for...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
abd4c0025539f142ec48a09e01430f7ee3b83214
github
async-runtime
https://github.com/tokio-rs/tokio/blob/abd4c0025539f142ec48a09e01430f7ee3b83214/tokio/src/runtime/builder.rs
521
549
tokio-rs/tokio:tokio/src/runtime/builder.rs:10
/// # Examples /// /// ``` /// use tokio::runtime::Builder; /// /// let rt = Builder::new_multi_thread().build().unwrap(); /// /// rt.block_on(async { /// println!("Hello from the Tokio runtime"); /// }); /// ``` pub fn build(&mut self) -> io::Result<Runtime> { m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
81db03204dab8961a5e1bb149877f9a8c31df3fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/81db03204dab8961a5e1bb149877f9a8c31df3fd/tokio/src/runtime/builder.rs
361
420
tokio-rs/tokio:tokio/src/runtime/builder.rs:11
/// .build(); /// # } /// ``` pub fn thread_keep_alive(&mut self, duration: Duration) -> &mut Self { self.keep_alive = Some(duration); self } fn build_basic_runtime(&mut self) -> io::Result<Runtime> { use crate::runtime::{BasicScheduler, Kind}; let (driver, reso...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
81db03204dab8961a5e1bb149877f9a8c31df3fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/81db03204dab8961a5e1bb149877f9a8c31df3fd/tokio/src/runtime/builder.rs
401
460
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
impl Builder { /// Enables the I/O driver. /// /// Doing this enables using net, process, signal, and some I/O types on /// the runtime. /// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
81db03204dab8961a5e1bb149877f9a8c31df3fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/81db03204dab8961a5e1bb149877f9a8c31df3fd/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
self.enable_time = true; self } } } cfg_rt_multi_thread! { impl Builder { fn build_threaded_runtime(&mut self) -> io::Result<Runtime> { use crate::loom::sys::num_cpus; use crate::runtime::{Kind, ThreadPool}; use crate::runtime::park::Parker; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
81db03204dab8961a5e1bb149877f9a8c31df3fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/81db03204dab8961a5e1bb149877f9a8c31df3fd/tokio/src/runtime/builder.rs
481
540
tokio-rs/tokio:tokio/src/runtime/builder.rs:14
Ok(Runtime { kind: Kind::ThreadPool(scheduler), handle, blocking_pool, }) } } } impl fmt::Debug for Builder { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("Builder") .field("worker_threads",...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
81db03204dab8961a5e1bb149877f9a8c31df3fd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/81db03204dab8961a5e1bb149877f9a8c31df3fd/tokio/src/runtime/builder.rs
521
544
tokio-rs/tokio:tokio/src/runtime/builder.rs:2
/// Runtime type kind: Kind, /// Whether or not to enable the I/O driver enable_io: bool, /// Whether or not to enable the time driver enable_time: bool, /// The number of worker threads, used by Runtime. /// /// Only used when not using the current-thread executor. worker_threads...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
30b40ef518d1767736c8ff47c794481e88bfd3e9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/30b40ef518d1767736c8ff47c794481e88bfd3e9/tokio/src/runtime/builder.rs
41
100
tokio-rs/tokio:tokio/src/runtime/builder.rs:3
impl Builder { /// Returns a new builder with the multi thread scheduler selected. /// /// Configuration methods can be chained on the return value. pub fn new_current_thread() -> Builder { Builder::new(Kind::CurrentThread) } /// Returns a new builder with the multi thread scheduler sel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
30b40ef518d1767736c8ff47c794481e88bfd3e9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/30b40ef518d1767736c8ff47c794481e88bfd3e9/tokio/src/runtime/builder.rs
81
140
tokio-rs/tokio:tokio/src/runtime/builder.rs:1
use crate::runtime::handle::Handle; use crate::runtime::{blocking, driver, Callback, Runtime, Spawner}; use std::fmt; use std::io; use std::time::Duration; /// Builds Tokio Runtime with custom configuration values. /// /// Methods can be chained in order to set the configuration values. The /// Runtime is constructed...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
00b6127f2ed3125f8b305ab4fd9bb90e99762785
github
async-runtime
https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/runtime/builder.rs
1
60
tokio-rs/tokio:tokio/src/runtime/builder.rs:2
/// Whether or not to enable the I/O driver enable_io: bool, /// Whether or not to enable the time driver enable_time: bool, /// The number of worker threads, used by Runtime. /// /// Only used when not using the current-thread executor. worker_threads: Option<usize>, /// Cap on threa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
00b6127f2ed3125f8b305ab4fd9bb90e99762785
github
async-runtime
https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/runtime/builder.rs
41
100
tokio-rs/tokio:tokio/src/runtime/builder.rs:3
/// TODO pub fn new_current_thread() -> Builder { Builder::new(Kind::CurrentThread) } /// TODO #[cfg(feature = "rt-multi-thread")] pub fn new_multi_thread() -> Builder { Builder::new(Kind::MultiThread) } /// Returns a new runtime builder initialized with default configurati...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
00b6127f2ed3125f8b305ab4fd9bb90e99762785
github
async-runtime
https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/runtime/builder.rs
81
140
tokio-rs/tokio:tokio/src/runtime/builder.rs:7
self.thread_name = std::sync::Arc::new(move || val.clone()); self } /// Sets a function used to generate the name of threads spawned by the `Runtime`'s thread pool. /// /// The default name fn is `|| "tokio-runtime-worker".into()`. /// /// # Examples /// /// ``` /// # use to...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
00b6127f2ed3125f8b305ab4fd9bb90e99762785
github
async-runtime
https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/runtime/builder.rs
241
300
tokio-rs/tokio:tokio/src/runtime/builder.rs:9
self } /// Executes function `f` before each thread stops. /// /// This is intended for bookkeeping and monitoring use cases. /// /// # Examples /// /// ``` /// # use tokio::runtime; /// /// # pub fn main() { /// let runtime = runtime::Builder::new_multi_thread() ///...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
00b6127f2ed3125f8b305ab4fd9bb90e99762785
github
async-runtime
https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/runtime/builder.rs
321
380
tokio-rs/tokio:tokio/src/runtime/builder.rs:10
/// rt.block_on(async { /// println!("Hello from the Tokio runtime"); /// }); /// ``` pub fn build(&mut self) -> io::Result<Runtime> { match &self.kind { Kind::CurrentThread => self.build_basic_runtime(), #[cfg(feature = "rt-multi-thread")] Kind::MultiThre...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
00b6127f2ed3125f8b305ab4fd9bb90e99762785
github
async-runtime
https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/runtime/builder.rs
361
420
tokio-rs/tokio:tokio/src/runtime/builder.rs:11
fn build_basic_runtime(&mut self) -> io::Result<Runtime> { use crate::runtime::{BasicScheduler, Kind}; let (driver, resources) = driver::Driver::new(self.get_cfg())?; // And now put a single-threaded scheduler on top of the timer. When // there are no futures ready to do something, it'...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
00b6127f2ed3125f8b305ab4fd9bb90e99762785
github
async-runtime
https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/runtime/builder.rs
401
460
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
/// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_io() /// .build() /// .unwrap(); /// ``` pub fn enable_io(&mut self) -> &mut Self { self.enable_io = true; sel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
00b6127f2ed3125f8b305ab4fd9bb90e99762785
github
async-runtime
https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
impl Builder { fn build_threaded_runtime(&mut self) -> io::Result<Runtime> { use crate::loom::sys::num_cpus; use crate::runtime::{Kind, ThreadPool}; use crate::runtime::park::Parker; use std::cmp; let core_threads = self.worker_threads.unwrap_or_else(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
00b6127f2ed3125f8b305ab4fd9bb90e99762785
github
async-runtime
https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/runtime/builder.rs
481
537
tokio-rs/tokio:tokio/src/runtime/builder.rs:14
} impl fmt::Debug for Builder { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("Builder") .field("worker_threads", &self.worker_threads) .field("max_threads", &self.max_threads) .field( "thread_name", &"<dyn ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
00b6127f2ed3125f8b305ab4fd9bb90e99762785
github
async-runtime
https://github.com/tokio-rs/tokio/blob/00b6127f2ed3125f8b305ab4fd9bb90e99762785/tokio/src/runtime/builder.rs
521
537
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
impl Builder { fn build_threaded_runtime(&mut self) -> io::Result<Runtime> { use crate::loom::sys::num_cpus; use crate::runtime::{Kind, ThreadPool}; use crate::runtime::park::Parker; use std::cmp; let core_threads = self.worker_threads.unwrap_or_else(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c90681bd8e629b5fde988b9f5be7b915e5cf8ae5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c90681bd8e629b5fde988b9f5be7b915e5cf8ae5/tokio/src/runtime/builder.rs
481
536
tokio-rs/tokio:tokio/src/runtime/builder.rs:14
impl fmt::Debug for Builder { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("Builder") .field("worker_threads", &self.worker_threads) .field("max_threads", &self.max_threads) .field( "thread_name", &"<dyn Fn(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c90681bd8e629b5fde988b9f5be7b915e5cf8ae5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c90681bd8e629b5fde988b9f5be7b915e5cf8ae5/tokio/src/runtime/builder.rs
521
536
tokio-rs/tokio:tokio/src/runtime/builder.rs:2
/// Whether or not to enable the I/O driver enable_io: bool, /// Whether or not to enable the time driver enable_time: bool, /// The number of worker threads, used by Runtime. /// /// Only used when not using the current-thread executor. worker_threads: Option<usize>, /// Cap on threa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
07802b2c8487c6e70e39d0b0cd6bf7705fc88337
github
async-runtime
https://github.com/tokio-rs/tokio/blob/07802b2c8487c6e70e39d0b0cd6bf7705fc88337/tokio/src/runtime/builder.rs
41
100
tokio-rs/tokio:tokio/src/runtime/builder.rs:3
/// TODO pub fn new_current_thread() -> Builder { Builder::new(Kind::CurrentThread) } /// TODO #[cfg(feature = "rt-threaded")] pub fn new_multi_thread() -> Builder { Builder::new(Kind::MultiThread) } /// Returns a new runtime builder initialized with default configuration ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
07802b2c8487c6e70e39d0b0cd6bf7705fc88337
github
async-runtime
https://github.com/tokio-rs/tokio/blob/07802b2c8487c6e70e39d0b0cd6bf7705fc88337/tokio/src/runtime/builder.rs
81
140
tokio-rs/tokio:tokio/src/runtime/builder.rs:9
self } /// Executes function `f` before each thread stops. /// /// This is intended for bookkeeping and monitoring use cases. /// /// # Examples /// /// ``` /// # use tokio::runtime; /// /// # pub fn main() { /// let runtime = runtime::Builder::new_multi_thread() ///...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
07802b2c8487c6e70e39d0b0cd6bf7705fc88337
github
async-runtime
https://github.com/tokio-rs/tokio/blob/07802b2c8487c6e70e39d0b0cd6bf7705fc88337/tokio/src/runtime/builder.rs
321
380
tokio-rs/tokio:tokio/src/runtime/builder.rs:10
/// rt.block_on(async { /// println!("Hello from the Tokio runtime"); /// }); /// ``` pub fn build(&mut self) -> io::Result<Runtime> { match &self.kind { Kind::CurrentThread => self.build_basic_runtime(), #[cfg(feature = "rt-threaded")] Kind::MultiThread =...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
07802b2c8487c6e70e39d0b0cd6bf7705fc88337
github
async-runtime
https://github.com/tokio-rs/tokio/blob/07802b2c8487c6e70e39d0b0cd6bf7705fc88337/tokio/src/runtime/builder.rs
361
420
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
/// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_io() /// .build() /// .unwrap(); /// ``` pub fn enable_io(&mut self) -> &mut Self { self.enable_io = true; sel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
07802b2c8487c6e70e39d0b0cd6bf7705fc88337
github
async-runtime
https://github.com/tokio-rs/tokio/blob/07802b2c8487c6e70e39d0b0cd6bf7705fc88337/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:9
/// This is intended for bookkeeping and monitoring use cases. /// /// # Examples /// /// ``` /// # use tokio::runtime; /// /// # pub fn main() { /// let runtime = runtime::Builder::new_multi_thread() /// .on_thread_stop(|| { /// println!("thread stopping"); /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
891de3271dc3545fb09162e578251e9977d9789c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/891de3271dc3545fb09162e578251e9977d9789c/tokio/src/runtime/builder.rs
321
380
tokio-rs/tokio:tokio/src/runtime/builder.rs:10
match &self.kind { Kind::CurrentThread => self.build_basic_runtime(), #[cfg(feature = "rt-threaded")] Kind::MultiThread => self.build_threaded_runtime(), } } fn get_cfg(&self) -> driver::Cfg { driver::Cfg { enable_io: self.enable_io, e...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
891de3271dc3545fb09162e578251e9977d9789c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/891de3271dc3545fb09162e578251e9977d9789c/tokio/src/runtime/builder.rs
361
420
tokio-rs/tokio:tokio/src/runtime/builder.rs:11
// And now put a single-threaded scheduler on top of the timer. When // there are no futures ready to do something, it'll let the timer or // the reactor to generate some new stimuli for the futures to continue // in their life. let scheduler = BasicScheduler::new(driver); let sp...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
891de3271dc3545fb09162e578251e9977d9789c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/891de3271dc3545fb09162e578251e9977d9789c/tokio/src/runtime/builder.rs
401
460
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
/// .enable_io() /// .build() /// .unwrap(); /// ``` pub fn enable_io(&mut self) -> &mut Self { self.enable_io = true; self } } } cfg_time! { impl Builder { /// Enables the time driver. /// /// Doing this enable...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
891de3271dc3545fb09162e578251e9977d9789c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/891de3271dc3545fb09162e578251e9977d9789c/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
use std::cmp; let core_threads = self.worker_threads.unwrap_or_else(|| cmp::min(self.max_threads, num_cpus())); assert!(core_threads <= self.max_threads, "Core threads number cannot be above max limit"); let (driver, resources) = driver::Driver::new(self.get_cfg())?; l...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
891de3271dc3545fb09162e578251e9977d9789c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/891de3271dc3545fb09162e578251e9977d9789c/tokio/src/runtime/builder.rs
481
531
tokio-rs/tokio:tokio/src/runtime/builder.rs:14
.field("max_threads", &self.max_threads) .field( "thread_name", &"<dyn Fn() -> String + Send + Sync + 'static>", ) .field("thread_stack_size", &self.thread_stack_size) .field("after_start", &self.after_start.as_ref().map(|_| "...")) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
891de3271dc3545fb09162e578251e9977d9789c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/891de3271dc3545fb09162e578251e9977d9789c/tokio/src/runtime/builder.rs
521
531
tokio-rs/tokio:tokio/src/runtime/builder.rs:4
keep_alive: None, } } /// Enables both I/O and time drivers. /// /// Doing this is a shorthand for calling `enable_io` and `enable_time` /// individually. If additional components are added to Tokio in the future, /// `enable_all` will include these future components. /// /// # ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/builder.rs
121
180
tokio-rs/tokio:tokio/src/runtime/builder.rs:7
let val = val.into(); self.thread_name = std::sync::Arc::new(move || val.clone()); self } /// Sets a function used to generate the name of threads spawned by the `Runtime`'s thread pool. /// /// The default name fn is `|| "tokio-runtime-worker".into()`. /// /// # Examples //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/builder.rs
241
300
tokio-rs/tokio:tokio/src/runtime/builder.rs:9
self.after_start = Some(std::sync::Arc::new(f)); self } /// Executes function `f` before each thread stops. /// /// This is intended for bookkeeping and monitoring use cases. /// /// # Examples /// /// ``` /// # use tokio::runtime; /// /// # pub fn main() { /// l...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/builder.rs
321
380
tokio-rs/tokio:tokio/src/runtime/builder.rs:10
/// /// rt.block_on(async { /// println!("Hello from the Tokio runtime"); /// }); /// ``` pub fn build(&mut self) -> io::Result<Runtime> { match &self.kind { Kind::CurrentThread => self.build_basic_runtime(), #[cfg(feature = "rt-threaded")] Kind::Multi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/builder.rs
361
420
tokio-rs/tokio:tokio/src/runtime/builder.rs:11
} fn build_basic_runtime(&mut self) -> io::Result<Runtime> { use crate::runtime::{BasicScheduler, Kind}; let (driver, resources) = driver::Driver::new(self.get_cfg())?; // And now put a single-threaded scheduler on top of the timer. When // there are no futures ready to do somethi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/builder.rs
401
460
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
/// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_io() /// .build() /// .unwrap(); /// ``` pub fn enable_io(&mut self) -> &mut Self { self.enable_io ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
cfg_rt_threaded! { impl Builder { fn build_threaded_runtime(&mut self) -> io::Result<Runtime> { use crate::loom::sys::num_cpus; use crate::runtime::{Kind, ThreadPool}; use crate::runtime::park::Parker; use std::cmp; let core_threads = self.worker_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/builder.rs
481
537
tokio-rs/tokio:tokio/src/runtime/builder.rs:1
use crate::runtime::handle::Handle; use crate::runtime::shell::Shell; use crate::runtime::{blocking, driver, io, Callback, Runtime, Spawner}; use std::fmt; #[cfg(feature = "blocking")] use std::time::Duration; /// Builds Tokio Runtime with custom configuration values. /// /// Methods can be chained in order to set th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
56acde069fe7fc57259e72de612f0c91c1320972
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56acde069fe7fc57259e72de612f0c91c1320972/tokio/src/runtime/builder.rs
1
60
tokio-rs/tokio:tokio/src/runtime/builder.rs:2
/// The task execution model to use. kind: Kind, /// Whether or not to enable the I/O driver enable_io: bool, /// Whether or not to enable the time driver enable_time: bool, /// The number of worker threads, used by Runtime. /// /// Only used when not using the current-thread executor...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
56acde069fe7fc57259e72de612f0c91c1320972
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56acde069fe7fc57259e72de612f0c91c1320972/tokio/src/runtime/builder.rs
41
100
tokio-rs/tokio:tokio/src/runtime/builder.rs:3
#[cfg(feature = "rt-core")] Basic, #[cfg(feature = "rt-threaded")] ThreadPool, } impl Builder { /// Returns a new runtime builder initialized with default configuration /// values. /// /// Configuration methods can be chained on the return value. pub fn new() -> Builder { Builde...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
56acde069fe7fc57259e72de612f0c91c1320972
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56acde069fe7fc57259e72de612f0c91c1320972/tokio/src/runtime/builder.rs
81
140
tokio-rs/tokio:tokio/src/runtime/builder.rs:4
} /// Enables both I/O and time drivers. /// /// Doing this is a shorthand for calling `enable_io` and `enable_time` /// individually. If additional components are added to Tokio in the future, /// `enable_all` will include these future components. /// /// # Examples /// /// ``` ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
56acde069fe7fc57259e72de612f0c91c1320972
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56acde069fe7fc57259e72de612f0c91c1320972/tokio/src/runtime/builder.rs
121
180
tokio-rs/tokio:tokio/src/runtime/builder.rs:5
/// The default value is the number of cores available to the system. pub fn num_threads(&mut self, val: usize) -> &mut Self { self.core_threads = Some(val); self } /// Sets the core number of worker threads for the `Runtime`'s thread pool. /// /// This should be a number between 1 ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
56acde069fe7fc57259e72de612f0c91c1320972
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56acde069fe7fc57259e72de612f0c91c1320972/tokio/src/runtime/builder.rs
161
220
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
/// The default value is 512. /// /// When multi-threaded runtime is not used, will act as limit on additional threads. /// /// Otherwise as `core_threads` are always active, it limits additional threads (e.g. for /// blocking annotations) as `max_threads - core_threads`. pub fn max_threads(&mut...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
56acde069fe7fc57259e72de612f0c91c1320972
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56acde069fe7fc57259e72de612f0c91c1320972/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:8
/// ``` pub fn thread_stack_size(&mut self, val: usize) -> &mut Self { self.thread_stack_size = Some(val); self } /// Executes function `f` after each thread is started but before it starts /// doing work. /// /// This is intended for bookkeeping and monitoring use cases. //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
56acde069fe7fc57259e72de612f0c91c1320972
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56acde069fe7fc57259e72de612f0c91c1320972/tokio/src/runtime/builder.rs
281
340
tokio-rs/tokio:tokio/src/runtime/builder.rs:9
/// ``` /// # use tokio::runtime; /// /// # pub fn main() { /// let runtime = runtime::Builder::new() /// .threaded_scheduler() /// .on_thread_stop(|| { /// println!("thread stopping"); /// }) /// .build(); /// # } /// ``` #[cfg(not(loom))] pub...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
56acde069fe7fc57259e72de612f0c91c1320972
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56acde069fe7fc57259e72de612f0c91c1320972/tokio/src/runtime/builder.rs
321
380
tokio-rs/tokio:tokio/src/runtime/builder.rs:10
Kind::Basic => self.build_basic_runtime(), #[cfg(feature = "rt-threaded")] Kind::ThreadPool => self.build_threaded_runtime(), } } fn get_cfg(&self) -> driver::Cfg { driver::Cfg { enable_io: self.enable_io, enable_time: self.enable_time, } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
56acde069fe7fc57259e72de612f0c91c1320972
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56acde069fe7fc57259e72de612f0c91c1320972/tokio/src/runtime/builder.rs
361
420
tokio-rs/tokio:tokio/src/runtime/builder.rs:11
/// /// By default, the timeout for a thread is set to 10 seconds. This can /// be overriden using .thread_keep_alive(). /// /// # Example /// /// ``` /// # use tokio::runtime; /// # use std::time::Duration; /// /// # pub fn main() { /// let rt = runtime::Builder::new() /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
56acde069fe7fc57259e72de612f0c91c1320972
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56acde069fe7fc57259e72de612f0c91c1320972/tokio/src/runtime/builder.rs
401
460
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
self.enable_io = true; self } } } cfg_time! { impl Builder { /// Enables the time driver. /// /// Doing this enables using `tokio::time` on the runtime. /// /// # Examples /// /// ``` /// use tokio::runtime; /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
56acde069fe7fc57259e72de612f0c91c1320972
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56acde069fe7fc57259e72de612f0c91c1320972/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
/// [`block_on`]: Runtime::block_on pub fn basic_scheduler(&mut self) -> &mut Self { self.kind = Kind::Basic; self } fn build_basic_runtime(&mut self) -> io::Result<Runtime> { use crate::runtime::{BasicScheduler, Kind}; let (driver, resources) = ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
56acde069fe7fc57259e72de612f0c91c1320972
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56acde069fe7fc57259e72de612f0c91c1320972/tokio/src/runtime/builder.rs
481
540
tokio-rs/tokio:tokio/src/runtime/builder.rs:14
/// Sets runtime to use a multi-threaded scheduler for executing tasks. /// /// See also [the module level documentation][1], which has a section on scheduler /// types. /// /// [1]: index.html#runtime-configurations pub fn threaded_scheduler(&mut self) -> &mut Self { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
56acde069fe7fc57259e72de612f0c91c1320972
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56acde069fe7fc57259e72de612f0c91c1320972/tokio/src/runtime/builder.rs
521
580
tokio-rs/tokio:tokio/src/runtime/builder.rs:15
handle.enter(|| launch.launch()); Ok(Runtime { kind: Kind::ThreadPool(scheduler), handle, blocking_pool, }) } } } impl Default for Builder { fn default() -> Self { Self::new() } } impl fmt::Debug for Builder { fn ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
56acde069fe7fc57259e72de612f0c91c1320972
github
async-runtime
https://github.com/tokio-rs/tokio/blob/56acde069fe7fc57259e72de612f0c91c1320972/tokio/src/runtime/builder.rs
561
593
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
pub fn max_threads(&mut self, val: usize) -> &mut Self { assert_ne!(val, 0, "Thread limit cannot be zero"); self.max_threads = val; self } /// Sets name of threads spawned by the `Runtime`'s thread pool. /// /// The default name is "tokio-runtime-worker". /// /// # Examp...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:8
/// Executes function `f` after each thread is started but before it starts /// doing work. /// /// This is intended for bookkeeping and monitoring use cases. /// /// # Examples /// /// ``` /// # use tokio::runtime; /// /// # pub fn main() { /// let runtime = runtime::Builder...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8/tokio/src/runtime/builder.rs
281
340
tokio-rs/tokio:tokio/src/runtime/builder.rs:9
/// .on_thread_stop(|| { /// println!("thread stopping"); /// }) /// .build(); /// # } /// ``` #[cfg(not(loom))] pub fn on_thread_stop<F>(&mut self, f: F) -> &mut Self where F: Fn() + Send + Sync + 'static, { self.before_stop = Some(std::sync::Arc:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8/tokio/src/runtime/builder.rs
321
380
tokio-rs/tokio:tokio/src/runtime/builder.rs:10
fn get_cfg(&self) -> driver::Cfg { driver::Cfg { enable_io: self.enable_io, enable_time: self.enable_time, } } fn build_shell_runtime(&mut self) -> io::Result<Runtime> { use crate::runtime::Kind; let (driver, resources) = driver::Driver::new(self.get_cfg...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8/tokio/src/runtime/builder.rs
361
420
tokio-rs/tokio:tokio/src/runtime/builder.rs:11
/// ``` /// # use tokio::runtime; /// # use std::time::Duration; /// /// # pub fn main() { /// let rt = runtime::Builder::new() /// .thread_keep_alive(Duration::from_millis(100)) /// .build(); /// # } /// ``` pub fn thread_keep_alive(&mut self, duration: Duration) -> &mut...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8/tokio/src/runtime/builder.rs
401
460
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
cfg_time! { impl Builder { /// Enables the time driver. /// /// Doing this enables using `tokio::time` on the runtime. /// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new() /// .enab...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
fn build_basic_runtime(&mut self) -> io::Result<Runtime> { use crate::runtime::{BasicScheduler, Kind}; let (driver, resources) = driver::Driver::new(self.get_cfg())?; // And now put a single-threaded scheduler on top of the timer. When // there are no futures ready to d...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8/tokio/src/runtime/builder.rs
481
540
tokio-rs/tokio:tokio/src/runtime/builder.rs:14
pub fn threaded_scheduler(&mut self) -> &mut Self { self.kind = Kind::ThreadPool; self } fn build_threaded_runtime(&mut self) -> io::Result<Runtime> { use crate::loom::sys::num_cpus; use crate::runtime::{Kind, ThreadPool}; use crate::runtime::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8/tokio/src/runtime/builder.rs
521
580
tokio-rs/tokio:tokio/src/runtime/builder.rs:15
}) } } } impl Default for Builder { fn default() -> Self { Self::new() } } impl fmt::Debug for Builder { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("Builder") .field("kind", &self.kind) .field("core_threads", &self.core...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8/tokio/src/runtime/builder.rs
561
587
tokio-rs/tokio:tokio/src/runtime/builder.rs:1
use crate::loom::sync::Mutex; use crate::runtime::handle::Handle; use crate::runtime::shell::Shell; use crate::runtime::{blocking, driver, io, Callback, Runtime, Spawner}; use std::fmt; #[cfg(feature = "blocking")] use std::time::Duration; /// Builds Tokio Runtime with custom configuration values. /// /// Methods can...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
f25f12d57638a2928b3f738b3b1392d8773e276e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f25f12d57638a2928b3f738b3b1392d8773e276e/tokio/src/runtime/builder.rs
1
60
tokio-rs/tokio:tokio/src/runtime/builder.rs:2
pub struct Builder { /// The task execution model to use. kind: Kind, /// Whether or not to enable the I/O driver enable_io: bool, /// Whether or not to enable the time driver enable_time: bool, /// The number of worker threads, used by Runtime. /// /// Only used when not using th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
f25f12d57638a2928b3f738b3b1392d8773e276e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f25f12d57638a2928b3f738b3b1392d8773e276e/tokio/src/runtime/builder.rs
41
100
tokio-rs/tokio:tokio/src/runtime/builder.rs:3
Shell, #[cfg(feature = "rt-core")] Basic, #[cfg(feature = "rt-threaded")] ThreadPool, } impl Builder { /// Returns a new runtime builder initialized with default configuration /// values. /// /// Configuration methods can be chained on the return value. pub fn new() -> Builder { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
f25f12d57638a2928b3f738b3b1392d8773e276e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f25f12d57638a2928b3f738b3b1392d8773e276e/tokio/src/runtime/builder.rs
81
140
tokio-rs/tokio:tokio/src/runtime/builder.rs:4
} } /// Enables both I/O and time drivers. /// /// Doing this is a shorthand for calling `enable_io` and `enable_time` /// individually. If additional components are added to Tokio in the future, /// `enable_all` will include these future components. /// /// # Examples /// /// `...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
f25f12d57638a2928b3f738b3b1392d8773e276e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f25f12d57638a2928b3f738b3b1392d8773e276e/tokio/src/runtime/builder.rs
121
180
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
/// blocking annotations) as `max_threads - core_threads`. pub fn max_threads(&mut self, val: usize) -> &mut Self { assert_ne!(val, 0, "Thread limit cannot be zero"); self.max_threads = val; self } /// Sets name of threads spawned by the `Runtime`'s thread pool. /// /// The ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
f25f12d57638a2928b3f738b3b1392d8773e276e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f25f12d57638a2928b3f738b3b1392d8773e276e/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:8
/// Executes function `f` after each thread is started but before it starts /// doing work. /// /// This is intended for bookkeeping and monitoring use cases. /// /// # Examples /// /// ``` /// # use tokio::runtime; /// /// # pub fn main() { /// let runtime = runtime::Builder...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
f25f12d57638a2928b3f738b3b1392d8773e276e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f25f12d57638a2928b3f738b3b1392d8773e276e/tokio/src/runtime/builder.rs
281
340
tokio-rs/tokio:tokio/src/runtime/builder.rs:9
/// .threaded_scheduler() /// .on_thread_stop(|| { /// println!("thread stopping"); /// }) /// .build(); /// # } /// ``` #[cfg(not(loom))] pub fn on_thread_stop<F>(&mut self, f: F) -> &mut Self where F: Fn() + Send + Sync + 'static, { self....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
f25f12d57638a2928b3f738b3b1392d8773e276e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f25f12d57638a2928b3f738b3b1392d8773e276e/tokio/src/runtime/builder.rs
321
380
tokio-rs/tokio:tokio/src/runtime/builder.rs:10
fn get_cfg(&self) -> driver::Cfg { driver::Cfg { enable_io: self.enable_io, enable_time: self.enable_time, } } fn build_shell_runtime(&mut self) -> io::Result<Runtime> { use crate::runtime::Kind; let (driver, resources) = driver::Driver::new(self.get_cfg...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
f25f12d57638a2928b3f738b3b1392d8773e276e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f25f12d57638a2928b3f738b3b1392d8773e276e/tokio/src/runtime/builder.rs
361
420
tokio-rs/tokio:tokio/src/runtime/builder.rs:11
/// /// ``` /// # use tokio::runtime; /// # use std::time::Duration; /// /// # pub fn main() { /// let rt = runtime::Builder::new() /// .thread_keep_alive(Duration::from_millis(100)) /// .build(); /// # } /// ``` pub fn thread_keep_alive(&mut self, duration: Duration)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
f25f12d57638a2928b3f738b3b1392d8773e276e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f25f12d57638a2928b3f738b3b1392d8773e276e/tokio/src/runtime/builder.rs
401
460
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
cfg_time! { impl Builder { /// Enables the time driver. /// /// Doing this enables using `tokio::time` on the runtime. /// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new() /// .enab...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
f25f12d57638a2928b3f738b3b1392d8773e276e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f25f12d57638a2928b3f738b3b1392d8773e276e/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
fn build_basic_runtime(&mut self) -> io::Result<Runtime> { use crate::runtime::{BasicScheduler, Kind}; let (driver, resources) = driver::Driver::new(self.get_cfg())?; // And now put a single-threaded scheduler on top of the timer. When // there are no futures ready to d...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
f25f12d57638a2928b3f738b3b1392d8773e276e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f25f12d57638a2928b3f738b3b1392d8773e276e/tokio/src/runtime/builder.rs
481
540
tokio-rs/tokio:tokio/src/runtime/builder.rs:14
/// [1]: index.html#runtime-configurations pub fn threaded_scheduler(&mut self) -> &mut Self { self.kind = Kind::ThreadPool; self } fn build_threaded_runtime(&mut self) -> io::Result<Runtime> { use crate::loom::sys::num_cpus; use crate::runtime::{...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
f25f12d57638a2928b3f738b3b1392d8773e276e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f25f12d57638a2928b3f738b3b1392d8773e276e/tokio/src/runtime/builder.rs
521
580
tokio-rs/tokio:tokio/src/runtime/builder.rs:15
blocking_pool, }) } } } impl Default for Builder { fn default() -> Self { Self::new() } } impl fmt::Debug for Builder { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("Builder") .field("kind", &self.kind) .field...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
f25f12d57638a2928b3f738b3b1392d8773e276e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f25f12d57638a2928b3f738b3b1392d8773e276e/tokio/src/runtime/builder.rs
561
588
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
cfg_time! { impl Builder { /// Enables the time driver. /// /// Doing this enables using `tokio::time` on the runtime. /// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new() /// .enab...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
fn build_basic_runtime(&mut self) -> io::Result<Runtime> { use crate::runtime::{BasicScheduler, Kind}; let (driver, resources) = driver::Driver::new(self.get_cfg())?; // And now put a single-threaded scheduler on top of the timer. When // there are no futures ready to d...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb/tokio/src/runtime/builder.rs
481
540
tokio-rs/tokio:tokio/src/runtime/builder.rs:1
use crate::loom::sync::Mutex; use crate::runtime::handle::Handle; use crate::runtime::shell::Shell; use crate::runtime::{blocking, io, time, Callback, Runtime, Spawner}; use std::fmt; #[cfg(feature = "blocking")] use std::time::Duration; /// Builds Tokio Runtime with custom configuration values. /// /// Methods can b...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8/tokio/src/runtime/builder.rs
1
60
tokio-rs/tokio:tokio/src/runtime/builder.rs:9
/// .threaded_scheduler() /// .on_thread_stop(|| { /// println!("thread stopping"); /// }) /// .build(); /// # } /// ``` #[cfg(not(loom))] pub fn on_thread_stop<F>(&mut self, f: F) -> &mut Self where F: Fn() + Send + Sync + 'static, { self....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8/tokio/src/runtime/builder.rs
321
380
tokio-rs/tokio:tokio/src/runtime/builder.rs:10
fn build_shell_runtime(&mut self) -> io::Result<Runtime> { use crate::runtime::Kind; let clock = time::create_clock(); // Create I/O driver let (io_driver, io_handle) = io::create_driver(self.enable_io)?; let (driver, time_handle) = time::create_driver(self.enable_time, io_driv...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8/tokio/src/runtime/builder.rs
361
420
tokio-rs/tokio:tokio/src/runtime/builder.rs:11
/// /// # pub fn main() { /// let rt = runtime::Builder::new() /// .thread_keep_alive(Duration::from_millis(100)) /// .build(); /// # } /// ``` pub fn thread_keep_alive(&mut self, duration: Duration) -> &mut Self { self.keep_alive = Some(duration); self } } cfg_i...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8/tokio/src/runtime/builder.rs
401
460
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
/// /// Doing this enables using `tokio::time` on the runtime. /// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new() /// .enable_time() /// .build() /// .unwrap(); /// ``...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
let clock = time::create_clock(); // Create I/O driver let (io_driver, io_handle) = io::create_driver(self.enable_io)?; let (driver, time_handle) = time::create_driver(self.enable_time, io_driver, clock.clone()); // And now put a single-threaded scheduler on top of the...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8/tokio/src/runtime/builder.rs
481
540
tokio-rs/tokio:tokio/src/runtime/builder.rs:14
/// [1]: index.html#runtime-configurations pub fn threaded_scheduler(&mut self) -> &mut Self { self.kind = Kind::ThreadPool; self } fn build_threaded_runtime(&mut self) -> io::Result<Runtime> { use crate::loom::sys::num_cpus; use crate::runtime::{...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8/tokio/src/runtime/builder.rs
521
580
tokio-rs/tokio:tokio/src/runtime/builder.rs:15
handle, blocking_pool, }) } } } impl Default for Builder { fn default() -> Self { Self::new() } } impl fmt::Debug for Builder { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("Builder") .field("kind", &self....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6866b24ca1a89fb6e7dbc63e20d8a66ee60a85b8/tokio/src/runtime/builder.rs
561
589
tokio-rs/tokio:tokio/src/runtime/builder.rs:1
use crate::loom::sync::{Arc, Mutex}; use crate::runtime::handle::Handle; use crate::runtime::shell::Shell; use crate::runtime::{blocking, io, time, Callback, Runtime, Spawner}; use std::fmt; #[cfg(feature = "blocking")] use std::time::Duration; /// Builds Tokio Runtime with custom configuration values. /// /// Method...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
f4d6ed03d9a4852f5222fd191143fe34725528a6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f4d6ed03d9a4852f5222fd191143fe34725528a6/tokio/src/runtime/builder.rs
1
60
tokio-rs/tokio:tokio/src/runtime/builder.rs:8
/// Executes function `f` after each thread is started but before it starts /// doing work. /// /// This is intended for bookkeeping and monitoring use cases. /// /// # Examples /// /// ``` /// # use tokio::runtime; /// /// # pub fn main() { /// let runtime = runtime::Builder...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
f4d6ed03d9a4852f5222fd191143fe34725528a6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f4d6ed03d9a4852f5222fd191143fe34725528a6/tokio/src/runtime/builder.rs
281
340