mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-07 00:00:08 +02:00
rt: fix Builder docs to no longer use deprecated methods (#749)
This commit is contained in:
+20
-16
@@ -28,24 +28,28 @@ use tokio_timer::timer::{self, Timer};
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # extern crate tokio;
|
/// extern crate tokio;
|
||||||
/// # extern crate tokio_threadpool;
|
/// extern crate tokio_timer;
|
||||||
/// # use tokio::runtime::Builder;
|
|
||||||
///
|
///
|
||||||
/// # pub fn main() {
|
/// use std::time::Duration;
|
||||||
/// // create and configure ThreadPool
|
|
||||||
/// let mut threadpool_builder = tokio_threadpool::Builder::new();
|
|
||||||
/// threadpool_builder
|
|
||||||
/// .name_prefix("my-runtime-worker-")
|
|
||||||
/// .pool_size(4);
|
|
||||||
///
|
///
|
||||||
/// // build Runtime
|
/// use tokio::runtime::Builder;
|
||||||
/// let runtime = Builder::new()
|
/// use tokio_timer::clock::Clock;
|
||||||
/// .threadpool_builder(threadpool_builder)
|
///
|
||||||
/// .build();
|
/// fn main() {
|
||||||
/// // ... call runtime.run(...)
|
/// // build Runtime
|
||||||
/// # let _ = runtime;
|
/// let mut runtime = Builder::new()
|
||||||
/// # }
|
/// .blocking_threads(4)
|
||||||
|
/// .clock(Clock::system())
|
||||||
|
/// .core_threads(4)
|
||||||
|
/// .keep_alive(Some(Duration::from_secs(60)))
|
||||||
|
/// .name_prefix("my-custom-name-")
|
||||||
|
/// .stack_size(3 * 1024 * 1024)
|
||||||
|
/// .build()
|
||||||
|
/// .unwrap();
|
||||||
|
///
|
||||||
|
/// // use runtime ...
|
||||||
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Builder {
|
pub struct Builder {
|
||||||
|
|||||||
Reference in New Issue
Block a user