Struct crates_index::Crate
source · pub struct Crate { /* private fields */ }
Expand description
A whole crate with all its versions
Implementations§
source§impl Crate
impl Crate
sourcepub fn versions(&self) -> &[Version]
pub fn versions(&self) -> &[Version]
All versions of this crate sorted chronologically by date originally published
Warning: may be yanked or duplicate
sourcepub fn highest_version(&self) -> &Version
pub fn highest_version(&self) -> &Version
The highest version as per semantic versioning specification
Warning: may be pre-release or yanked
sourcepub fn highest_normal_version(&self) -> Option<&Version>
pub fn highest_normal_version(&self) -> Option<&Version>
Returns crate version with the highest version number according to semver, but excludes pre-release and yanked versions.
0.x.y versions are included.
May return None
if the crate has only pre-release or yanked versions.
sourcepub fn most_recent_version(&self) -> &Version
pub fn most_recent_version(&self) -> &Version
The last release by date, even if it’s yanked or less than highest version.
sourcepub fn earliest_version(&self) -> &Version
pub fn earliest_version(&self) -> &Version
First version ever published. May be yanked.
It is not guaranteed to be the lowest version number.
sourcepub fn new<P: AsRef<Path>>(index_path: P) -> Result<Crate>
pub fn new<P: AsRef<Path>>(index_path: P) -> Result<Crate>
Parse an index file with all of crate’s versions.
The file must contain at least one version.
sourcepub fn from_slice(bytes: &[u8]) -> Result<Crate>
pub fn from_slice(bytes: &[u8]) -> Result<Crate>
Parse crate file from in-memory JSON-lines data