Struct tame_index::krate::IndexKrate
source · 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§fn eq(&self, other: &IndexKrate) -> bool
fn eq(&self, other: &IndexKrate) -> bool
self
and other
values to be equal, and is used
by ==
.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<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.