diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 80f8a6141..4958bd12d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -171,7 +171,7 @@ jobs: components: rustfmt, clippy - uses: Swatinem/rust-cache@v2 - run: cargo fmt --all -- --check - - run: cargo check --locked --manifest-path quinn/Cargo.toml --all-targets --no-default-features + - run: cargo check --locked --manifest-path quinn/Cargo.toml --all-targets --no-default-features --features runtime-tokio - run: cargo clippy --locked --all-targets -- -D warnings - uses: dtolnay/rust-toolchain@stable with: diff --git a/quinn/Cargo.toml b/quinn/Cargo.toml index 42a3d4917..a2a2431df 100644 --- a/quinn/Cargo.toml +++ b/quinn/Cargo.toml @@ -37,7 +37,8 @@ rustls-ring = ["dep:rustls", "ring", "proto/rustls-ring", "proto/ring"] ring = ["proto/ring"] runtime-tokio = ["tokio/time", "tokio/rt", "tokio/net"] runtime-smol = ["dep:async-io", "dep:smol"] - +# Allow users to declare a custom runtimne +custom-runtime = [] # Configure `tracing` to log events via `log` if no `tracing` subscriber exists. tracing-log = ["tracing/log", "proto/tracing-log", "udp/tracing-log"] # Enable rustls logging diff --git a/quinn/src/runtime/mod.rs b/quinn/src/runtime/mod.rs index 15a7a1112..b4a7fb572 100644 --- a/quinn/src/runtime/mod.rs +++ b/quinn/src/runtime/mod.rs @@ -13,6 +13,9 @@ use udp::{RecvMeta, Transmit}; use crate::Instant; +#[cfg(not(any(feature = "runtime-tokio", feature = "runtime-smol", feature = "custom-runtime")))] +compile_error!("no async runtime found. Please enable a runtime feature such as runtime-tokio, runtime-smol or custom-runtime"); + /// Abstracts I/O and timer operations for runtime independence pub trait Runtime: Send + Sync + Debug + 'static { /// Construct a timer that will expire at `i`