922
922
}
923
923
924
924
s_no_extra_traits ! {
925
- #[ allow( missing_debug_implementations) ]
926
925
pub struct sysinfo {
927
926
pub uptime: :: c_ulong,
928
927
pub loads: [ :: c_ulong; 3 ] ,
@@ -940,20 +939,17 @@ s_no_extra_traits! {
940
939
pub __reserved: [ :: c_char; 256 ] ,
941
940
}
942
941
943
- #[ allow( missing_debug_implementations) ]
944
942
pub struct sockaddr_un {
945
943
pub sun_family: sa_family_t,
946
944
pub sun_path: [ :: c_char; 108 ]
947
945
}
948
946
949
- #[ allow( missing_debug_implementations) ]
950
947
pub struct sockaddr_storage {
951
948
pub ss_family: sa_family_t,
952
949
__ss_align: :: size_t,
953
950
__ss_pad2: [ u8 ; 128 - 2 * 8 ] ,
954
951
}
955
952
956
- #[ allow( missing_debug_implementations) ]
957
953
pub struct utsname {
958
954
pub sysname: [ :: c_char; 65 ] ,
959
955
pub nodename: [ :: c_char; 65 ] ,
@@ -963,7 +959,6 @@ s_no_extra_traits! {
963
959
pub domainname: [ :: c_char; 65 ]
964
960
}
965
961
966
- #[ allow( missing_debug_implementations) ]
967
962
pub struct dirent {
968
963
pub d_ino: :: ino_t,
969
964
pub d_off: :: off_t,
@@ -972,7 +967,6 @@ s_no_extra_traits! {
972
967
pub d_name: [ :: c_char; 256 ] ,
973
968
}
974
969
975
- #[ allow( missing_debug_implementations) ]
976
970
pub struct dirent64 {
977
971
pub d_ino: :: ino64_t,
978
972
pub d_off: :: off64_t,
@@ -982,6 +976,248 @@ s_no_extra_traits! {
982
976
}
983
977
}
984
978
979
+
980
+ cfg_if ! {
981
+ if #[ cfg( feature = "extra_traits" ) ] {
982
+ impl PartialEq for sysinfo {
983
+ fn eq( & self , other: & sysinfo) -> bool {
984
+ self . uptime == other. uptime
985
+ && self . loads == other. loads
986
+ && self . totalram == other. totalram
987
+ && self . freeram == other. freeram
988
+ && self . sharedram == other. sharedram
989
+ && self . bufferram == other. bufferram
990
+ && self . totalswap == other. totalswap
991
+ && self . freeswap == other. freeswap
992
+ && self . procs == other. procs
993
+ && self . pad == other. pad
994
+ && self . totalhigh == other. totalhigh
995
+ && self . freehigh == other. freehigh
996
+ && self . mem_unit == other. mem_unit
997
+ && self
998
+ . __reserved
999
+ . iter( )
1000
+ . zip( other. __reserved. iter( ) )
1001
+ . all( |( a, b) | a == b)
1002
+ }
1003
+ }
1004
+ impl Eq for sysinfo { }
1005
+ impl :: fmt:: Debug for sysinfo {
1006
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
1007
+ f. debug_struct( "sysinfo" )
1008
+ . field( "uptime" , & self . uptime)
1009
+ . field( "loads" , & self . loads)
1010
+ . field( "totalram" , & self . totalram)
1011
+ . field( "freeram" , & self . freeram)
1012
+ . field( "sharedram" , & self . sharedram)
1013
+ . field( "bufferram" , & self . bufferram)
1014
+ . field( "totalswap" , & self . totalswap)
1015
+ . field( "freeswap" , & self . freeswap)
1016
+ . field( "procs" , & self . procs)
1017
+ . field( "pad" , & self . pad)
1018
+ . field( "totalhigh" , & self . totalhigh)
1019
+ . field( "freehigh" , & self . freehigh)
1020
+ . field( "mem_unit" , & self . mem_unit)
1021
+ // FIXME: .field("__reserved", &self.__reserved)
1022
+ . finish( )
1023
+ }
1024
+ }
1025
+ impl :: hash:: Hash for sysinfo {
1026
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
1027
+ self . uptime. hash( state) ;
1028
+ self . loads. hash( state) ;
1029
+ self . totalram. hash( state) ;
1030
+ self . freeram. hash( state) ;
1031
+ self . sharedram. hash( state) ;
1032
+ self . bufferram. hash( state) ;
1033
+ self . totalswap. hash( state) ;
1034
+ self . freeswap. hash( state) ;
1035
+ self . procs. hash( state) ;
1036
+ self . pad. hash( state) ;
1037
+ self . totalhigh. hash( state) ;
1038
+ self . freehigh. hash( state) ;
1039
+ self . mem_unit. hash( state) ;
1040
+ self . __reserved. hash( state) ;
1041
+ }
1042
+ }
1043
+
1044
+ impl PartialEq for sockaddr_un {
1045
+ fn eq( & self , other: & sockaddr_un) -> bool {
1046
+ self . sun_family == other. sun_family
1047
+ && self
1048
+ . sun_path
1049
+ . iter( )
1050
+ . zip( other. sun_path. iter( ) )
1051
+ . all( |( a, b) | a == b)
1052
+ }
1053
+ }
1054
+ impl Eq for sockaddr_un { }
1055
+ impl :: fmt:: Debug for sockaddr_un {
1056
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
1057
+ f. debug_struct( "sockaddr_un" )
1058
+ . field( "sun_family" , & self . sun_family)
1059
+ // FIXME: .field("sun_path", &self.sun_path)
1060
+ . finish( )
1061
+ }
1062
+ }
1063
+ impl :: hash:: Hash for sockaddr_un {
1064
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
1065
+ self . sun_family. hash( state) ;
1066
+ self . sun_path. hash( state) ;
1067
+ }
1068
+ }
1069
+
1070
+ impl PartialEq for sockaddr_storage {
1071
+ fn eq( & self , other: & sockaddr_storage) -> bool {
1072
+ self . ss_family == other. ss_family
1073
+ && self . __ss_align == other. __ss_align
1074
+ && self
1075
+ . __ss_pad2
1076
+ . iter( )
1077
+ . zip( other. __ss_pad2. iter( ) )
1078
+ . all( |( a, b) | a == b)
1079
+ }
1080
+ }
1081
+ impl Eq for sockaddr_storage { }
1082
+ impl :: fmt:: Debug for sockaddr_storage {
1083
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
1084
+ f. debug_struct( "sockaddr_storage" )
1085
+ . field( "ss_family" , & self . ss_family)
1086
+ . field( "__ss_align" , & self . __ss_align)
1087
+ // FIXME: .field("__ss_pad2", &self.__ss_pad2)
1088
+ . finish( )
1089
+ }
1090
+ }
1091
+ impl :: hash:: Hash for sockaddr_storage {
1092
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
1093
+ self . ss_family. hash( state) ;
1094
+ self . __ss_align. hash( state) ;
1095
+ self . __ss_pad2. hash( state) ;
1096
+ }
1097
+ }
1098
+
1099
+ impl PartialEq for utsname {
1100
+ fn eq( & self , other: & utsname) -> bool {
1101
+ self . sysname
1102
+ . iter( )
1103
+ . zip( other. sysname. iter( ) )
1104
+ . all( |( a, b) | a == b)
1105
+ && self
1106
+ . nodename
1107
+ . iter( )
1108
+ . zip( other. nodename. iter( ) )
1109
+ . all( |( a, b) | a == b)
1110
+ && self
1111
+ . release
1112
+ . iter( )
1113
+ . zip( other. release. iter( ) )
1114
+ . all( |( a, b) | a == b)
1115
+ && self
1116
+ . version
1117
+ . iter( )
1118
+ . zip( other. version. iter( ) )
1119
+ . all( |( a, b) | a == b)
1120
+ && self
1121
+ . machine
1122
+ . iter( )
1123
+ . zip( other. machine. iter( ) )
1124
+ . all( |( a, b) | a == b)
1125
+ }
1126
+ }
1127
+ impl Eq for utsname { }
1128
+ impl :: fmt:: Debug for utsname {
1129
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
1130
+ f. debug_struct( "utsname" )
1131
+ // FIXME: .field("sysname", &self.sysname)
1132
+ // FIXME: .field("nodename", &self.nodename)
1133
+ // FIXME: .field("release", &self.release)
1134
+ // FIXME: .field("version", &self.version)
1135
+ // FIXME: .field("machine", &self.machine)
1136
+ . finish( )
1137
+ }
1138
+ }
1139
+ impl :: hash:: Hash for utsname {
1140
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
1141
+ self . sysname. hash( state) ;
1142
+ self . nodename. hash( state) ;
1143
+ self . release. hash( state) ;
1144
+ self . version. hash( state) ;
1145
+ self . machine. hash( state) ;
1146
+ }
1147
+ }
1148
+
1149
+ impl PartialEq for dirent {
1150
+ fn eq( & self , other: & dirent) -> bool {
1151
+ self . d_ino == other. d_ino
1152
+ && self . d_off == other. d_off
1153
+ && self . d_reclen == other. d_reclen
1154
+ && self . d_type == other. d_type
1155
+ && self
1156
+ . d_name
1157
+ . iter( )
1158
+ . zip( other. d_name. iter( ) )
1159
+ . all( |( a, b) | a == b)
1160
+ }
1161
+ }
1162
+ impl Eq for dirent { }
1163
+ impl :: fmt:: Debug for dirent {
1164
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
1165
+ f. debug_struct( "dirent" )
1166
+ . field( "d_ino" , & self . d_ino)
1167
+ . field( "d_off" , & self . d_off)
1168
+ . field( "d_reclen" , & self . d_reclen)
1169
+ . field( "d_type" , & self . d_type)
1170
+ // FIXME: .field("d_name", &self.d_name)
1171
+ . finish( )
1172
+ }
1173
+ }
1174
+ impl :: hash:: Hash for dirent {
1175
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
1176
+ self . d_ino. hash( state) ;
1177
+ self . d_off. hash( state) ;
1178
+ self . d_reclen. hash( state) ;
1179
+ self . d_type. hash( state) ;
1180
+ self . d_name. hash( state) ;
1181
+ }
1182
+ }
1183
+
1184
+ impl PartialEq for dirent64 {
1185
+ fn eq( & self , other: & dirent64) -> bool {
1186
+ self . d_ino == other. d_ino
1187
+ && self . d_off == other. d_off
1188
+ && self . d_reclen == other. d_reclen
1189
+ && self . d_type == other. d_type
1190
+ && self
1191
+ . d_name
1192
+ . iter( )
1193
+ . zip( other. d_name. iter( ) )
1194
+ . all( |( a, b) | a == b)
1195
+ }
1196
+ }
1197
+ impl Eq for dirent64 { }
1198
+ impl :: fmt:: Debug for dirent64 {
1199
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
1200
+ f. debug_struct( "dirent64" )
1201
+ . field( "d_ino" , & self . d_ino)
1202
+ . field( "d_off" , & self . d_off)
1203
+ . field( "d_reclen" , & self . d_reclen)
1204
+ . field( "d_type" , & self . d_type)
1205
+ // FIXME: .field("d_name", &self.d_name)
1206
+ . finish( )
1207
+ }
1208
+ }
1209
+ impl :: hash:: Hash for dirent64 {
1210
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
1211
+ self . d_ino. hash( state) ;
1212
+ self . d_off. hash( state) ;
1213
+ self . d_reclen. hash( state) ;
1214
+ self . d_type. hash( state) ;
1215
+ self . d_name. hash( state) ;
1216
+ }
1217
+ }
1218
+ }
1219
+ }
1220
+
985
1221
// PUB_CONST
986
1222
987
1223
pub const INT_MIN : c_int = -2147483648 ;
0 commit comments