From e36f7933aba0dc5ea0c1a29d75d5a2c6a734d6e5 Mon Sep 17 00:00:00 2001 From: Jon Magnuson Date: Fri, 10 Nov 2023 16:29:03 -0600 Subject: [PATCH 1/2] build: add `compile_error!` if no runtime is set Rust will still throw compiler errors for all the usages of tokio, but this at least adds some context to the failures, in plain English. --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index f79d3aa..155deab 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -42,3 +42,6 @@ pub use reader::{Line, MuxedLines}; #[cfg(doctest)] doc_comment::doctest!("../README.md"); + +#[cfg(not(any(feature = "tokio")))] +compile_error!("At least one runtime feature must be enabled from: [\"tokio\"]"); From 9b17424df590345667f0de4f6f7da52e92ee7b14 Mon Sep 17 00:00:00 2001 From: Jon Magnuson Date: Fri, 10 Nov 2023 16:42:34 -0600 Subject: [PATCH 2/2] doc: add feature flags section to README Includes a note about how one runtime feature must be enabled. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index f602210..9695ea6 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,13 @@ Add linemux to your `Cargo.toml` with: linemux = "0.3" ``` +### Feature flags + +Note that building with `default-features: false` must also be coupled with activating a desired +runtime (currently just `tokio`, but eventually others will be supported). + +- `tokio`: Use the tokio runtime (default). + ## Example ```rust,no_run