1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-27 18:02:58 +01:00

simplify default_tokio_runtime

This commit is contained in:
Rob Ede 2023-11-06 22:27:11 +00:00
parent c008d716c9
commit 26289b8427
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
2 changed files with 4 additions and 12 deletions

View File

@ -45,6 +45,7 @@
#![allow(clippy::type_complexity)] #![allow(clippy::type_complexity)]
#![doc(html_logo_url = "https://actix.rs/img/logo.png")] #![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")] #![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#[cfg(all(not(target_os = "linux"), feature = "io-uring"))] #[cfg(all(not(target_os = "linux"), feature = "io-uring"))]
compile_error!("io_uring is a linux only feature."); compile_error!("io_uring is a linux only feature.");
@ -78,9 +79,9 @@ pub mod signal {
#[cfg(unix)] #[cfg(unix)]
pub mod unix { pub mod unix {
//! Unix specific signals (Tokio re-exports). //! Unix specific signals (Tokio re-exports).
// pub use tokio::signal::unix::*; pub use tokio::signal::unix::*;
} }
// pub use tokio::signal::ctrl_c; pub use tokio::signal::ctrl_c;
} }
#[cfg(feature = "net")] #[cfg(feature = "net")]

View File

@ -12,18 +12,9 @@ pub struct Runtime {
rt: tokio::runtime::Runtime, rt: tokio::runtime::Runtime,
} }
#[cfg(feature = "net")]
pub(crate) fn default_tokio_runtime() -> io::Result<tokio::runtime::Runtime> { pub(crate) fn default_tokio_runtime() -> io::Result<tokio::runtime::Runtime> {
tokio::runtime::Builder::new_current_thread() tokio::runtime::Builder::new_current_thread()
.enable_io() .enable_all()
.enable_time()
.build()
}
#[cfg(not(feature = "net"))]
pub(crate) fn default_tokio_runtime() -> io::Result<tokio::runtime::Runtime> {
tokio::runtime::Builder::new_current_thread()
.enable_time()
.build() .build()
} }