@@ -32,34 +32,34 @@ use url::Url;
3232#[ derive( Debug , Clone , Serialize , Deserialize ) ]
3333#[ serde( tag = "version" , content = "data" ) ]
3434#[ serde( rename_all = "camelCase" ) ]
35- pub enum VersionedProjectModel {
35+ pub enum VersionedPackageModel {
3636 /// Version 1 of the project model.
3737 #[ serde( rename = "1" ) ]
38- V1 ( ProjectModelV1 ) ,
38+ V1 ( PackageModelV1 ) ,
3939 // When adding don't forget to update the highest_version function
4040}
4141
42- impl VersionedProjectModel {
42+ impl VersionedPackageModel {
4343 /// Highest version of the project model.
4444 pub fn highest_version ( ) -> u32 {
4545 // increase this when adding a new version
4646 1
4747 }
4848
4949 /// Move into the v1 type, returns None if the version is not v1.
50- pub fn into_v1 ( self ) -> Option < ProjectModelV1 > {
50+ pub fn into_v1 ( self ) -> Option < PackageModelV1 > {
5151 match self {
52- VersionedProjectModel :: V1 ( v) => Some ( v) ,
52+ VersionedPackageModel :: V1 ( v) => Some ( v) ,
5353 // Add this once we have more versions
5454 //_ => None,
5555 }
5656 }
5757
5858 /// Returns a reference to the v1 type, returns None if the version is not
5959 /// v1.
60- pub fn as_v1 ( & self ) -> Option < & ProjectModelV1 > {
60+ pub fn as_v1 ( & self ) -> Option < & PackageModelV1 > {
6161 match self {
62- VersionedProjectModel :: V1 ( v) => Some ( v) ,
62+ VersionedPackageModel :: V1 ( v) => Some ( v) ,
6363 // Add this once we have more versions
6464 //_ => None,
6565 }
@@ -71,7 +71,7 @@ pub type SourcePackageName = String;
7171
7272#[ derive( Debug , Default , Clone , Serialize , Deserialize , PartialEq , Eq ) ]
7373#[ serde( rename_all = "camelCase" ) ]
74- pub struct ProjectModelV1 {
74+ pub struct PackageModelV1 {
7575 /// The name of the project
7676 pub name : Option < String > ,
7777
@@ -102,22 +102,22 @@ pub struct ProjectModelV1 {
102102 /// URL of the project documentation
103103 pub documentation : Option < Url > ,
104104
105- /// The target of the project , this may contain
105+ /// The target of the package , this may contain
106106 /// platform specific configurations.
107107 pub targets : Option < TargetsV1 > ,
108108}
109109
110- impl IsDefault for ProjectModelV1 {
110+ impl IsDefault for PackageModelV1 {
111111 type Item = Self ;
112112
113113 fn is_non_default ( & self ) -> Option < & Self :: Item > {
114114 Some ( self )
115115 }
116116}
117117
118- impl From < ProjectModelV1 > for VersionedProjectModel {
119- fn from ( value : ProjectModelV1 ) -> Self {
120- VersionedProjectModel :: V1 ( value)
118+ impl From < PackageModelV1 > for VersionedPackageModel {
119+ fn from ( value : PackageModelV1 ) -> Self {
120+ VersionedPackageModel :: V1 ( value)
121121 }
122122}
123123
@@ -193,13 +193,13 @@ impl IsDefault for TargetsV1 {
193193#[ derive( Debug , Clone , Default , Serialize , Deserialize , PartialEq , Eq ) ]
194194#[ serde( rename_all = "camelCase" ) ]
195195pub struct TargetV1 {
196- /// Host dependencies of the project
196+ /// Host dependencies of the package
197197 pub host_dependencies : Option < OrderMap < SourcePackageName , PackageSpecV1 > > ,
198198
199- /// Build dependencies of the project
199+ /// Build dependencies of the package
200200 pub build_dependencies : Option < OrderMap < SourcePackageName , PackageSpecV1 > > ,
201201
202- /// Run dependencies of the project
202+ /// Run dependencies of the package
203203 pub run_dependencies : Option < OrderMap < SourcePackageName , PackageSpecV1 > > ,
204204}
205205
@@ -415,12 +415,12 @@ impl std::fmt::Debug for BinaryPackageSpecV1 {
415415}
416416
417417// Custom Hash implementations that skip default values for stability
418- impl Hash for ProjectModelV1 {
418+ impl Hash for PackageModelV1 {
419419 /// Custom hash implementation using StableHashBuilder to ensure different
420420 /// field configurations produce different hashes while maintaining
421421 /// forward/backward compatibility.
422422 fn hash < H : std:: hash:: Hasher > ( & self , state : & mut H ) {
423- let ProjectModelV1 {
423+ let PackageModelV1 {
424424 name,
425425 version,
426426 description,
@@ -644,8 +644,8 @@ mod tests {
644644
645645 #[ test]
646646 fn test_hash_stability_with_default_values ( ) {
647- // Create a minimal ProjectModelV1 instance
648- let mut project_model = ProjectModelV1 {
647+ // Create a minimal PackageModelV1 instance
648+ let mut project_model = PackageModelV1 {
649649 name : Some ( "test-project" . to_string ( ) ) ,
650650 version : None ,
651651 description : None ,
@@ -700,8 +700,8 @@ mod tests {
700700
701701 #[ test]
702702 fn test_hash_changes_with_meaningful_values ( ) {
703- // Create a minimal ProjectModelV1 instance
704- let mut project_model = ProjectModelV1 {
703+ // Create a minimal PackageModelV1 instance
704+ let mut project_model = PackageModelV1 {
705705 name : Some ( "test-project" . to_string ( ) ) ,
706706 version : None ,
707707 description : None ,
@@ -995,15 +995,15 @@ mod tests {
995995
996996 #[ test]
997997 fn test_hash_collision_bug_project_model ( ) {
998- // Test the same issue in ProjectModelV1
999- let project1 = ProjectModelV1 {
998+ // Test the same issue in PackageModelV1
999+ let project1 = PackageModelV1 {
10001000 name : Some ( "test" . to_string ( ) ) ,
10011001 description : Some ( "test description" . to_string ( ) ) ,
10021002 license : None ,
10031003 ..Default :: default ( )
10041004 } ;
10051005
1006- let project2 = ProjectModelV1 {
1006+ let project2 = PackageModelV1 {
10071007 name : Some ( "test" . to_string ( ) ) ,
10081008 description : None ,
10091009 license : Some ( "test description" . to_string ( ) ) ,
@@ -1015,7 +1015,7 @@ mod tests {
10151015
10161016 assert_ne ! (
10171017 hash1, hash2,
1018- "Same value in different fields should produce different hashes in ProjectModelV1 "
1018+ "Same value in different fields should produce different hashes in PackageModelV1 "
10191019 ) ;
10201020 }
10211021}
0 commit comments