find

Function find 

Source
pub fn find(
    rust_version: &str,
    target: &str,
) -> Result<impl Iterator<Item = TargetFeature>, NotFoundError>
Expand description

Find the target features applicable to a Rust version and target.

use rust_target_feature_data::NotFoundError;

// Different versions return different features
for (version, count) in [
//  ("1.83.0", 90),
//  ("1.84.0", 91),
    ("1.85.0", 92),
    ("1.86.0", 92),
    ("1.87.0", 92),
] {
    assert_eq!(
        rust_target_feature_data::find(version, "aarch64-apple-darwin")?.count(),
        count,
    );
}

// 1.84.0 data is not included
assert_eq!(
    rust_target_feature_data::find("1.84.0", "x86_64-unknown-linux-gnu").err().unwrap(),
    NotFoundError::CompilerNotFound("1.84.0".into())
);

// i686-unknown-redox became i586-unknown-redox
assert!(
    rust_target_feature_data::find("1.85.0", "i686-unknown-redox").is_ok()
);
assert_eq!(
    rust_target_feature_data::find("1.86.0", "i686-unknown-redox").err().unwrap(),
    NotFoundError::TargetNotFound("i686-unknown-redox".into())
);