1
1
use chrono:: NaiveDateTime ;
2
- use std:: collections:: HashMap ;
3
2
use url:: Url ;
4
3
5
4
use crate :: github;
6
5
use crate :: models:: {
7
- Badge , Category , Crate , CrateOwnerInvitation , CreatedApiToken , Dependency , DependencyKind ,
8
- Keyword , Owner , ReverseDependency , Team , TopVersions , User , Version , VersionDownload ,
6
+ Category , Crate , CrateOwnerInvitation , CreatedApiToken , Dependency , DependencyKind , Keyword ,
7
+ Owner , ReverseDependency , Team , TopVersions , User , Version , VersionDownload ,
9
8
VersionOwnerAction ,
10
9
} ;
11
10
use crate :: util:: rfc3339;
@@ -14,19 +13,6 @@ use crate::util::rfc3339;
14
13
/// and are possibly of malicious intent e.g. ad tracking networks, etc.
15
14
const DOCUMENTATION_BLOCKLIST : & [ & str ] = & [ "rust-ci.org" , "rustless.org" , "ironframework.io" ] ;
16
15
17
- #[ derive( PartialEq , Eq , Debug , Serialize , Deserialize ) ]
18
- pub struct EncodableBadge {
19
- pub badge_type : String ,
20
- pub attributes : HashMap < String , Option < String > > ,
21
- }
22
-
23
- impl From < Badge > for EncodableBadge {
24
- fn from ( badge : Badge ) -> Self {
25
- // The serde attributes on Badge ensure it can be deserialized to EncodableBadge
26
- serde_json:: from_value ( serde_json:: to_value ( badge) . unwrap ( ) ) . unwrap ( )
27
- }
28
- }
29
-
30
16
#[ derive( Serialize , Deserialize , Debug ) ]
31
17
pub struct EncodableCategory {
32
18
pub id : String ,
@@ -216,7 +202,7 @@ pub struct EncodableCrate {
216
202
pub versions : Option < Vec < i32 > > ,
217
203
pub keywords : Option < Vec < String > > ,
218
204
pub categories : Option < Vec < String > > ,
219
- pub badges : Option < Vec < EncodableBadge > > ,
205
+ pub badges : Option < Vec < ( ) > > ,
220
206
#[ serde( with = "rfc3339" ) ]
221
207
pub created_at : NaiveDateTime ,
222
208
// NOTE: Used by shields.io, altering `downloads` requires a PR with shields.io
@@ -242,7 +228,7 @@ impl EncodableCrate {
242
228
versions : Option < Vec < i32 > > ,
243
229
keywords : Option < & [ Keyword ] > ,
244
230
categories : Option < & [ Category ] > ,
245
- badges : Option < Vec < Badge > > ,
231
+ badges : Option < Vec < ( ) > > ,
246
232
exact_match : bool ,
247
233
recent_downloads : Option < i64 > ,
248
234
) -> Self {
@@ -313,7 +299,7 @@ impl EncodableCrate {
313
299
pub fn from_minimal (
314
300
krate : Crate ,
315
301
top_versions : Option < & TopVersions > ,
316
- badges : Option < Vec < Badge > > ,
302
+ badges : Option < Vec < ( ) > > ,
317
303
exact_match : bool ,
318
304
recent_downloads : Option < i64 > ,
319
305
) -> Self {
0 commit comments