Repository: tokio-rs/tokio
File: tokio/src/runtime/mod.rs (Rust)

Code before:
    /// Calls to `shutdown` and `shutdown_timeout` require exclusive ownership of
    /// the runtime type and this can be achieved via `Arc::try_unwrap` when only
    /// one strong count reference is left over.
    ///
    /// [timer]: crate::time
    /// [mod]: index.html
    /// [`new`]: method@Self::new
    /// [`Builder`]: struct@Builder
    #[derive(Debug)]
    pub struct Runtime {
        /// Task scheduler
        scheduler: Scheduler,

        /// Handle to runtime, also contains driver handles
        handle: Handle,

        /// Blocking pool handle, used to signal shutdown
        blocking_pool: BlockingPool,
    }

    /// The flavor of the `Runtime`.
    #[derive(Debug, PartialEq)]
    pub enum RuntimeFlavor {
        /// The flavor that executes all tasks on the current thread.
        CurrentThread,
        /// The flavor that executes tasks across multiple threads.
        MultiThread,
    }

    /// The runtime scheduler is either a multi-thread or a current-thread executor.
    #[derive(Debug)]
    enum Scheduler {
        /// Execute all tasks on the current-thread.
        CurrentThread(CurrentThread),

        /// Execute tasks across multiple threads.
        #[cfg(all(feature = "rt-multi-thread", not(tokio_wasi)))]
        MultiThread(MultiThread),
    }

    /// After thread starts / before thread stops
    type Callback = std::sync::Arc<dyn Fn() + Send + Sync>;

    impl Runtime {
        cfg_not_wasi! {
            /// Creates a new runtime instance with default configuration values.
            ///
            /// This results in the multi threaded scheduler, I/O driver, and time driver being
            /// initialized.
            ///
            /// Most applications will not need to call this function directly. Instead,

Review comment (bug):
We must be able to add additional flavors in the future.
```suggestion
    /// The flavor of the `Runtime`.
    #[derive(Debug, PartialEq)]
    #[non_exhaustive]
    pub enum RuntimeFlavor {
```

Code after:
    /// Calls to `shutdown` and `shutdown_timeout` require exclusive ownership of
    /// the runtime type and this can be achieved via `Arc::try_unwrap` when only
    /// one strong count reference is left over.
    ///
    /// [timer]: crate::time
    /// [mod]: index.html
    /// [`new`]: method@Self::new
    /// [`Builder`]: struct@Builder
    #[derive(Debug)]
    pub struct Runtime {
        /// Task scheduler
        scheduler: Scheduler,

        /// Handle to runtime, also contains driver handles
        handle: Handle,

        /// Blocking pool handle, used to signal shutdown
        blocking_pool: BlockingPool,
    }

    /// The flavor of a `Runtime`.
    ///
    /// This is the return type for [`Handle::runtime_flavor`](crate::runtime::Handle::runtime_flavor()).
    #[derive(Debug, PartialEq, Eq)]
    #[non_exhaustive]
    pub enum RuntimeFlavor {
        /// The flavor that executes all tasks on the current thread.
        CurrentThread,
        /// The flavor that executes tasks across multiple threads.
        MultiThread,
    }

    /// The runtime scheduler is either a multi-thread or a current-thread executor.
    #[derive(Debug)]
    enum Scheduler {
        /// Execute all tasks on the current-thread.
        CurrentThread(CurrentThread),

        /// Execute tasks across multiple threads.
        #[cfg(all(feature = "rt-multi-thread", not(tokio_wasi)))]
        MultiThread(MultiThread),
    }

    /// After thread starts / before thread stops
    type Callback = std::sync::Arc<dyn Fn() + Send + Sync>;

    impl Runtime {
        cfg_not_wasi! {
            /// Creates a new runtime instance with default configuration values.
            ///
            /// This results in the multi threaded scheduler, I/O driver, and time driver being