Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove hard dependency for tokio net and tokio signal #467

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions actix-rt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ allowed_external_types = [
]

[features]
default = ["macros"]
default = ["macros", "net"]
macros = ["actix-macros"]
io-uring = ["tokio-uring"]
net = ["tokio/net", "tokio/signal"]

[dependencies]
actix-macros = { version = "0.2.3", optional = true }

futures-core = { version = "0.3", default-features = false }
tokio = { version = "1.23.1", features = ["rt", "net", "parking_lot", "signal", "sync", "time"] }
tokio = { version = "1.23.1", features = ["rt", "parking_lot", "sync", "time"] }

# runtime for `io-uring` feature
[target.'cfg(target_os = "linux")'.dependencies]
Expand Down
3 changes: 3 additions & 0 deletions actix-rt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#![allow(clippy::type_complexity)]
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![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"))]
compile_error!("io_uring is a linux only feature.");
Expand All @@ -71,6 +72,7 @@ pub use self::{
system::{System, SystemRunner},
};

#[cfg(feature = "net")]
pub mod signal {
//! Asynchronous signal handling (Tokio re-exports).

Expand All @@ -82,6 +84,7 @@ pub mod signal {
pub use tokio::signal::ctrl_c;
}

#[cfg(feature = "net")]
pub mod net {
//! TCP/UDP/Unix bindings (mostly Tokio re-exports).

Expand Down
3 changes: 1 addition & 2 deletions actix-rt/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ pub struct Runtime {

pub(crate) fn default_tokio_runtime() -> io::Result<tokio::runtime::Runtime> {
tokio::runtime::Builder::new_current_thread()
.enable_io()
.enable_time()
.enable_all()
.build()
}

Expand Down