Skip to main content

parse_latest_stable

Function parse_latest_stable 

Source
pub fn parse_latest_stable(body: &str) -> Option<Version>
Expand description

Parses a crates.io sparse-index response body and returns the highest published stable (non-prerelease, non-yanked) version, if any.

The index’s vers field has no v prefix (e.g. "0.1.3", not "v0.1.3"); we do not strip one — see the test below.

Malformed lines, entries with an unparseable vers, yanked entries, and prerelease versions are all silently skipped rather than treated as errors — an empty/garbage body simply yields None.