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