Skip to content

Commit 0e0e06e

Browse files
authored
chore: Add some comments (#9846)
1 parent 3416687 commit 0e0e06e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/models/krate.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@ impl Crate {
331331
}
332332

333333
/// Return both the newest (most recently updated) and
334-
/// highest version (in semver order) for the current crate.
334+
/// highest version (in semver order) for the current crate,
335+
/// where all top versions are not yanked.
335336
pub fn top_versions(&self, conn: &mut impl Conn) -> QueryResult<TopVersions> {
336337
Ok(TopVersions::from_date_version_pairs(
337338
self.versions()
@@ -475,10 +476,12 @@ impl From<BoxedAppError> for OwnerAddError {
475476
}
476477

477478
pub trait CrateVersions {
479+
/// Return all non-yanked versions of a crate.
478480
fn versions(&self) -> versions::BoxedQuery<'_, Pg> {
479481
self.all_versions().filter(versions::yanked.eq(false))
480482
}
481483

484+
/// Return all versions of a crate, including yanked ones.
482485
fn all_versions(&self) -> versions::BoxedQuery<'_, Pg>;
483486
}
484487

src/models/version.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ fn strip_build_metadata(version: &str) -> &str {
126126

127127
/// The highest version (semver order) and the most recently updated version.
128128
/// Typically used for a single crate.
129+
/// Note: `TopVersion` itself does not guarantee whether versions are yanked or not,
130+
/// this must be guaranteed by the input versions.
129131
#[derive(Debug, Clone, Eq, PartialEq)]
130132
pub struct TopVersions {
131133
/// The "highest" version in terms of semver

0 commit comments

Comments
 (0)