Skip to content

Commit

Permalink
Use cfg instead of feature
Browse files Browse the repository at this point in the history
  • Loading branch information
larseggert committed Oct 11, 2024
1 parent 32edcd7 commit 4f86c50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 0 additions & 2 deletions quinn-udp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 7 additions & 2 deletions quinn-udp/build.rs
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)) },
}
}

0 comments on commit 4f86c50

Please sign in to comment.