2 ms·
> Managing build configurations... In terms of package management, you can apply rules to what crates you want to include; including specific platform constrai
by markjgx 4y ago
> Managing build configurations...
In terms of package management, you can apply rules to what crates you want to include; including specific platform constraints.
[target.'cfg(target_os = "linux")'.dependencies]
nix = "0.5"
On the code side it's pretty much the same as C++. You have a module that defines an interface and per-platform implementations that are included depending on a "configuration conditional check" #[cfg(target_os = "linux")] macro.
https://github.com/tokio-rs/mio/blob/c6b5f13adf67483d927b1766faf984c1871e8abc/src/sys/mod.rs#L54-L64 https://github.com/tokio-rs/mio/blob/c6b5f13adf67483d927b176...