Skip to content

Commit 6d29a62

Browse files
committed
Add doc comments to new types and public functions
1 parent 3b43ea5 commit 6d29a62

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/version/build_info.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use schema::*;
2121
#[belongs_to(Version)]
2222
#[table_name = "build_info"]
2323
#[primary_key(version_id, rust_version, target)]
24-
/// Stores information about whether this version built or not on the specified Rust version and
24+
/// Stores information about whether this version built on the specified Rust version and
2525
/// target.
2626
pub struct BuildInfo {
2727
version_id: i32,
@@ -30,6 +30,9 @@ pub struct BuildInfo {
3030
pub passed: bool,
3131
}
3232

33+
/// The columns to select from the `build_info` table. The table also stores `created_at` and
34+
/// `updated_at` metadata for each row, but we're not displaying those anywhere so we're not
35+
/// bothering to select them.
3336
pub const BUILD_INFO_FIELDS: (
3437
build_info::version_id,
3538
build_info::rust_version,
@@ -44,13 +47,16 @@ pub const BUILD_INFO_FIELDS: (
4447

4548
#[derive(Debug)]
4649
/// The maximum version of Rust from each channel that a crate version successfully builds with.
50+
/// Used for summarizing this information in badge form on crate list pages.
4751
pub struct MaxBuildInfo {
4852
pub stable: Option<semver::Version>,
4953
pub beta: Option<NaiveDate>,
5054
pub nightly: Option<NaiveDate>,
5155
}
5256

5357
impl MaxBuildInfo {
58+
/// Encode stable semver number as a string and beta and nightly as times appropriate for
59+
/// JSON.
5460
pub fn encode(self) -> EncodableMaxVersionBuildInfo {
5561
fn naive_date_to_rfc3339(date: NaiveDate) -> String {
5662
DateTime::<Utc>::from_utc(date.and_hms(0, 0, 0), Utc).to_rfc3339()
@@ -65,6 +71,9 @@ impl MaxBuildInfo {
6571
}
6672

6773
impl BuildInfo {
74+
/// From a set of build information data, Find the largest or latest Rust versions that we know
75+
/// about for each channel. Stable uses the largest semver version number; beta and nightly use
76+
/// the latest date.
6877
pub fn max<I>(build_infos: I) -> CargoResult<MaxBuildInfo>
6978
where
7079
I: IntoIterator<Item = BuildInfo>,

src/version/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ impl Version {
171171
Ok(())
172172
}
173173

174+
/// Orders SemVer numbers so that "higher" version numbers appear first.
174175
pub fn semantically_newest_first(a: &Self, b: &Self) -> ::std::cmp::Ordering {
175176
b.num.cmp(&a.num)
176177
}

src/views/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ pub struct EncodableVersionBuildInfo {
7878
}
7979

8080
#[derive(Debug, Default, Serialize, Deserialize)]
81+
/// MaxBuildInfo in JSON form.
8182
pub struct EncodableMaxVersionBuildInfo {
8283
pub stable: Option<String>,
8384
pub beta: Option<String>,

0 commit comments

Comments
 (0)