Sha256: e0755ed1889b4c6f0faaa5adee5f60f27f9926becff875dbb41b6a65ae756591
Contents?: true
Size: 930 Bytes
Versions: 1
Compression:
Stored size: 930 Bytes
Contents
use crate::error::{Error, Result}; use crate::iter::Iter; use crate::token; use proc_macro::Group; #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub struct Release { pub minor: u16, pub patch: Option<u16>, } pub fn parse(paren: Group, iter: Iter) -> Result<Release> { try_parse(iter).map_err(|()| Error::group(paren, "expected rustc release number, like 1.31")) } fn try_parse(iter: Iter) -> Result<Release, ()> { let major_minor = token::parse_literal(iter).map_err(drop)?; let string = major_minor.to_string(); if !string.starts_with("1.") { return Err(()); } let minor: u16 = string[2..].parse().map_err(drop)?; let patch = if token::parse_optional_punct(iter, '.').is_some() { let int = token::parse_literal(iter).map_err(drop)?; Some(int.to_string().parse().map_err(drop)?) } else { None }; Ok(Release { minor, patch }) }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wasmtime-29.0.0 | ./ext/cargo-vendor/rustversion-1.0.19/src/release.rs |