@@ -21,7 +21,7 @@ use schema::*;
21
21
#[ belongs_to( Version ) ]
22
22
#[ table_name = "build_info" ]
23
23
#[ 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
25
25
/// target.
26
26
pub struct BuildInfo {
27
27
version_id : i32 ,
@@ -30,6 +30,9 @@ pub struct BuildInfo {
30
30
pub passed : bool ,
31
31
}
32
32
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.
33
36
pub const BUILD_INFO_FIELDS : (
34
37
build_info:: version_id ,
35
38
build_info:: rust_version ,
@@ -44,13 +47,16 @@ pub const BUILD_INFO_FIELDS: (
44
47
45
48
#[ derive( Debug ) ]
46
49
/// 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.
47
51
pub struct MaxBuildInfo {
48
52
pub stable : Option < semver:: Version > ,
49
53
pub beta : Option < NaiveDate > ,
50
54
pub nightly : Option < NaiveDate > ,
51
55
}
52
56
53
57
impl MaxBuildInfo {
58
+ /// Encode stable semver number as a string and beta and nightly as times appropriate for
59
+ /// JSON.
54
60
pub fn encode ( self ) -> EncodableMaxVersionBuildInfo {
55
61
fn naive_date_to_rfc3339 ( date : NaiveDate ) -> String {
56
62
DateTime :: < Utc > :: from_utc ( date. and_hms ( 0 , 0 , 0 ) , Utc ) . to_rfc3339 ( )
@@ -65,6 +71,9 @@ impl MaxBuildInfo {
65
71
}
66
72
67
73
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.
68
77
pub fn max < I > ( build_infos : I ) -> CargoResult < MaxBuildInfo >
69
78
where
70
79
I : IntoIterator < Item = BuildInfo > ,
0 commit comments