pub struct IndexKrate {
pub versions: Vec<IndexVersion>,
}
Expand description
A whole crate with all its versions
Fields§
§versions: Vec<IndexVersion>
All versions of the crate, sorted chronologically by when it was published
Implementations§
Source§impl IndexKrate
impl IndexKrate
Sourcepub fn write_cache_entry<W: Write>(
&self,
writer: &mut W,
revision: &str,
) -> Result<(), Error>
pub fn write_cache_entry<W: Write>( &self, writer: &mut W, revision: &str, ) -> Result<(), Error>
Writes a cache entry with the specified revision to an std::io::Write
Note this method creates its own internal std::io::BufWriter
, there
is no need to wrap it yourself
Source§impl IndexKrate
impl IndexKrate
Sourcepub fn highest_version(&self) -> &IndexVersion
pub fn highest_version(&self) -> &IndexVersion
The highest version as per semantic versioning specification
Note this may be a pre-release or yanked, use Self::highest_normal_version
to filter to the highest version that is not one of those
Sourcepub fn highest_normal_version(&self) -> Option<&IndexVersion>
pub fn highest_normal_version(&self) -> Option<&IndexVersion>
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) -> &IndexVersion
pub fn most_recent_version(&self) -> &IndexVersion
The last release by date, even if it’s yanked or less than highest version.
Sourcepub fn earliest_version(&self) -> &IndexVersion
pub fn earliest_version(&self) -> &IndexVersion
First version ever published. May be yanked.
It is not guaranteed to be the lowest version number.
Source§impl IndexKrate
impl IndexKrate
Sourcepub fn new(index_path: impl AsRef<Path>) -> Result<Self, Error>
pub fn new(index_path: impl AsRef<Path>) -> Result<Self, Error>
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<Self, Error>
pub fn from_slice(bytes: &[u8]) -> Result<Self, Error>
Parse a crate from in-memory JSON-lines data
Sourcepub fn write_json_lines<W: Write>(&self, writer: &mut W) -> Result<(), Error>
pub fn write_json_lines<W: Write>(&self, writer: &mut W) -> Result<(), Error>
Writes this crate into a JSON-lines formatted buffer
Note this creates its own internal std::io::BufWriter
, there is no
need to wrap it in your own
Trait Implementations§
Source§impl Clone for IndexKrate
impl Clone for IndexKrate
Source§fn clone(&self) -> IndexKrate
fn clone(&self) -> IndexKrate
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for IndexKrate
impl Debug for IndexKrate
Source§impl<'de> Deserialize<'de> for IndexKrate
impl<'de> Deserialize<'de> for IndexKrate
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>,
Source§impl PartialEq for IndexKrate
impl PartialEq for IndexKrate
Source§impl Serialize for IndexKrate
impl Serialize for IndexKrate
impl Eq for IndexKrate
impl StructuralPartialEq for IndexKrate
Auto Trait Implementations§
impl Freeze for IndexKrate
impl RefUnwindSafe for IndexKrate
impl Send for IndexKrate
impl Sync for IndexKrate
impl Unpin for IndexKrate
impl UnwindSafe for IndexKrate
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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