From 4f86c5058740a9295b74f87c8cab6206a60e9971 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Fri, 11 Oct 2024 13:14:57 +0300 Subject: [PATCH] Use `cfg` instead of `feature` --- quinn-udp/Cargo.toml | 2 -- quinn-udp/build.rs | 9 +++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/quinn-udp/Cargo.toml b/quinn-udp/Cargo.toml index c4c0ada257..7e88790f1c 100644 --- a/quinn-udp/Cargo.toml +++ b/quinn-udp/Cargo.toml @@ -18,8 +18,6 @@ default = ["tracing", "log"] # Configure `tracing` to log events via `log` if no `tracing` subscriber exists. log = ["tracing/log"] direct-log = ["dep:log"] -# Use private Apple APIs to send multiple packets in a single syscall. -fast-apple-datapath = [] [dependencies] libc = "0.2.158" diff --git a/quinn-udp/build.rs b/quinn-udp/build.rs index ef89ff70fb..f49aee8625 100644 --- a/quinn-udp/build.rs +++ b/quinn-udp/build.rs @@ -1,6 +1,11 @@ use cfg_aliases::cfg_aliases; fn main() { + if std::env::var("CARGO_CFG_QUINN_UDP_APPLE_FAST_DATAPATH").is_ok() { + // Use private Apple APIs to send multiple packets in a single syscall. + println!("cargo:rustc-cfg=quinn_udp_apple_fast_datapath"); + }; + // Setup cfg aliases cfg_aliases! { // Platforms @@ -20,7 +25,7 @@ fn main() { ) }, // Convenience aliases - apple_fast: { all(apple, feature = "fast-apple-datapath") }, - apple_slow: { all(apple, not(feature = "fast-apple-datapath")) }, + apple_fast: { all(apple, quinn_udp_apple_fast_datapath) }, + apple_slow: { all(apple, not(quinn_udp_apple_fast_datapath)) }, } }