cmri 0.1.1

Pure-Rust decoding/encoding of packets for CMRInet
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! * Sets toolchain cfg value, so that benchmarks can be conditionally compiled.
//!   (To be removed after <https://doc.rust-lang.org/unstable-book/library-features/test.html> is in stable).

use std::process::Command;

#[allow(clippy::unwrap_used)]
fn main() {
    let mut command = Command::new("rustc");
    command.arg("--version");
    let output = String::from_utf8(command.output().unwrap().stdout).unwrap();
    let output = output.trim();

    let parts: Vec<&str> = output.split(' ').skip(1).collect();
    let (_version, toolchain) = parts[0].split_once('-').unwrap_or((parts[0], "stable"));

    println!("cargo::rustc-check-cfg=cfg(toolchain, values(\"stable\", \"nightly\"))");
    println!("cargo:rustc-cfg=toolchain={toolchain:?}");
}