Crate feature_probe[][src]

To support multiple versions of Rust, it's often necessary to conditionally compile parts of our libraries or programs. It's possible to allow users to specify what features to enable, but detection is better, because users get all the features that their version of Rust supports. And while we could check the rustc version, it's better to probe for individual features. That way, code will work both on nightly, and on stable releases after particular features stabilize, without changes.


It’s on, so you can add

feature-probe = "0.1.1"

Then add to your

extern crate feature_probe;

use feature_probe::Probe;

Then you can probe for features such as types or expressions. For example:

fn main () {
    let probe = Probe::new();

    if probe.probe_type("i128") {

    if probe.probe_type("::std::ops::RangeInclusive<u64>") {

This crate supports Rust version 1.16.0 and later.



A probe object, which is used for probing for features.