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§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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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