@@ -44,13 +44,6 @@ impl<'a> Deserialize<'a> for PackageId {
4444 }
4545}
4646
47- impl std:: hash:: Hash for PackageId {
48- fn hash < H : std:: hash:: Hasher > ( & self , state : & mut H ) {
49- self . package_name . hash ( state) ;
50- self . publisher_node . hash ( state) ;
51- }
52- }
53-
5447impl std:: str:: FromStr for PackageId {
5548 type Err = ProcessIdParseError ;
5649 /// Attempt to parse a `PackageId` from a string. The string must
@@ -84,12 +77,27 @@ impl std::str::FromStr for PackageId {
8477 }
8578}
8679
80+ impl std:: hash:: Hash for PackageId {
81+ fn hash < H : std:: hash:: Hasher > ( & self , state : & mut H ) {
82+ self . package_name . hash ( state) ;
83+ self . publisher_node . hash ( state) ;
84+ }
85+ }
86+
8787impl std:: fmt:: Display for PackageId {
8888 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
8989 write ! ( f, "{}:{}" , self . package_name, self . publisher_node)
9090 }
9191}
9292
93+ impl From < ( & str , & str ) > for PackageId {
94+ fn from ( input : ( & str , & str ) ) -> Self {
95+ PackageId :: new ( input. 0 , input. 1 )
96+ }
97+ }
98+
99+ impl std:: cmp:: Eq for PackageId { }
100+
93101impl PartialEq for PackageId {
94102 fn eq ( & self , other : & Self ) -> bool {
95103 self . package_name == other. package_name && self . publisher_node == other. publisher_node
0 commit comments