@@ -35,18 +35,8 @@ pub struct TargetDescription {
3535///
3636/// Unix-like is related to `BSD` and other POSIX-compatible systems.
3737#[ derive( Deserialize , Serialize , PartialEq , Clone , Debug ) ]
38- #[ serde( rename_all = "snake_case" , untagged) ]
39- pub enum OsVariant {
40- Android ,
41- #[ allow( non_camel_case_types) ]
42- iOS,
43- Linux ,
44- UnixLike ,
45- Windows ,
46- #[ allow( non_camel_case_types) ]
47- macOS,
48- Other ( String ) ,
49- }
38+ #[ serde( rename_all = "snake_case" ) ]
39+ pub struct OsVariant ( pub String ) ;
5040
5141/// OS version specification.
5242///
@@ -69,22 +59,15 @@ pub enum OsVersionSpecification {
6959
7060impl std:: fmt:: Display for TargetDescription {
7161 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
72- let os = match & self . os {
73- OsVariant :: Android => "android" ,
74- OsVariant :: iOS => "ios" ,
75- OsVariant :: Linux => "linux" ,
76- OsVariant :: UnixLike => "unix" ,
77- OsVariant :: Windows => "windows" ,
78- OsVariant :: macOS => "macos" ,
79- OsVariant :: Other ( other) => other,
80- } ;
81-
8262 let os_ver = match & self . os_version {
8363 OsVersionSpecification :: No => "any" ,
8464 OsVersionSpecification :: Weak { version } => & format ! ( "^{}" , version) ,
8565 OsVersionSpecification :: Strong { version } => version,
8666 } ;
8767
88- f. write_str ( & format ! ( "{}/{}@{}@{}" , self . arch, os, self . os_derivative, os_ver) )
68+ f. write_str ( & format ! (
69+ "{}/{}@{}@{}" ,
70+ self . arch, self . os. 0 , self . os_derivative, os_ver
71+ ) )
8972 }
9073}
0 commit comments