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
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Crate
impl<'de> Deserialize<'de> for Crate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Crate
impl RefUnwindSafe for Crate
impl Send for Crate
impl Sync for Crate
impl Unpin for Crate
impl UnwindSafe for Crate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more