Crates.io | crate_version_parse |
lib.rs | crate_version_parse |
version | 0.2.0 |
source | src |
created_at | 2020-02-08 01:40:05.293676 |
updated_at | 2020-02-27 14:05:59.141973 |
description | simply parses crate-semver from a string |
homepage | |
repository | https://github.com/museun/crate_version_parse |
max_upload_size | |
id | 206250 |
size | 8,961 |
A crate name and version parser
serde
enables serde supportstd
to enable std::error::Error
let input = "zstd-sys-1.4.15+zstd.1.4.4";
let crate_ = CrateVersion::try_parse(input).unwrap();
assert_eq!(crate_.name, "zstd-sys");
assert_eq!(crate_.version, "1.4.15+zstd.1.4.4");
let input = "wasi-0.9.0+wasi-snapshot-preview1";
let crate_ = CrateVersion::try_parse(input).unwrap();
assert_eq!(crate_.name, "wasi");
assert_eq!(crate_.version, "0.9.0+wasi-snapshot-preview1");
let input = "winapi-i686-pc-windows-gnu-0.4.0";
let crate_ = CrateVersion::try_parse(input).unwrap();
assert_eq!(crate_.name, "winapi-i686-pc-windows-gnu");
assert_eq!(crate_.version, "0.4.0");
License: 0BSD