Struct tokio::runtime::Builder
[−]
[src]
pub struct Builder { /* fields omitted */ }
Builds Tokio Runtime with custom configuration values.
Methods can be chained in order to set the configuration values. The
Runtime is constructed by calling build
.
New instances of Builder
are obtained via Builder::new
.
See function level documentation for details on the various configuration settings.
Examples
// create and configure ThreadPool let mut threadpool_builder = tokio_threadpool::Builder::new(); threadpool_builder .name_prefix("my-runtime-worker-") .pool_size(4); // build Runtime let runtime = Builder::new() .threadpool_builder(threadpool_builder) .build(); // ... call runtime.run(...)
Methods
impl Builder
[src]
pub fn new() -> Builder
[src]
Returns a new runtime builder initialized with default configuration values.
Configuration methods can be chained on the return value.
ⓘImportant traits for &'a mut Rpub fn clock(&mut self, clock: Clock) -> &mut Self
[src]
ⓘImportant traits for &'a mut R
Set the Clock
instance that will be used by the runtime.
ⓘImportant traits for &'a mut Rpub fn threadpool_builder(&mut self, val: ThreadPoolBuilder) -> &mut Self
[src]
ⓘImportant traits for &'a mut R
Set builder to set up the thread pool instance.
pub fn build(&mut self) -> Result<Runtime>
[src]
Create the configured Runtime
.
The returned ThreadPool
instance is ready to spawn tasks.
Examples
let runtime = Builder::new().build().unwrap(); // ... call runtime.run(...)