Function built::util::parse_versions
[−]
[src]
pub fn parse_versions<'a, T>(
name_and_versions: T
) -> Map<<T as IntoIterator>::IntoIter, fn(_: &'a (&'a str, &'a str)) -> (&'a str, Version)> where
T: IntoIterator<Item = &'a (&'a str, &'a str)>,
Parses version-strings with semver::Version::parse()
.
This function is only available if built
was compiled with the
serialized_version
feature.
The function takes a reference to an array of names and version numbers as
serialized by built
and returns an iterator over the unchanged names
and parsed version numbers.
extern crate built; extern crate semver; pub mod build_info { pub const DEPENDENCIES: [(&'static str, &'static str); 1] = [("built", "0.1.0")]; } let deps = build_info::DEPENDENCIES; assert!(built::util::parse_versions(&deps) .any(|(name, ver)| name == "built" && ver >= semver::Version::parse("0.1.0").unwrap()));
Panics
If a version can't be parsed by semver::Version::parse()
. This should never
happen with version strings provided by Cargo and built
.