Skip to main content

RuntimeBuilder

Struct RuntimeBuilder 

Source
pub struct RuntimeBuilder { /* private fields */ }
Expand description

Builder for configuring and creating an async runtime.

Provides a convenient way to configure the runtime’s I/O driver before building it.

§Examples

use vibeio::RuntimeBuilder;

let runtime = RuntimeBuilder::new()
    .build();

Implementations§

Source§

impl RuntimeBuilder

Source

pub fn new() -> Self

Creates a new runtime builder with default configuration.

By default, the builder will select the best available driver for the platform.

Source

pub fn driver(self, driver_kind: DriverKind) -> Self

Sets the I/O driver for the runtime.

Source

pub fn enable_timer(self, enable: bool) -> Self

Enables or disables the timer for the runtime.

By default, the timer is disabled.

Source

pub fn enable_fs_offload(self, enable: bool) -> Self

Enables or disables the offload of file I/O to blocking threads for the runtime.

By default, the fs offload is disabled.

Source

pub fn blocking_pool(self, blocking_pool: Box<dyn BlockingThreadPool>) -> Self

Sets the blocking thread pool for the runtime.

Source

pub fn default_blocking_pool(self, max_threads: usize) -> Self

Sets the default blocking thread pool for the runtime with specified maximum number of threads.

Source

pub fn build(self) -> Result<Runtime, Error>

Builds the async runtime with the configured settings.

If no driver was explicitly set, selects the best available driver for the platform.

Trait Implementations§

Source§

impl Default for RuntimeBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.