Implement Hash for all types
This commit is contained in:
parent
79ae1217c2
commit
cd1e16d1af
|
@ -45,8 +45,9 @@ libc = { version = "0.2", features = ["align"] }
|
||||||
```
|
```
|
||||||
|
|
||||||
All structs implemented by the libc crate have the `Copy` and `Clone` traits
|
All structs implemented by the libc crate have the `Copy` and `Clone` traits
|
||||||
implemented for them. The additional traits of `Debug, `Eq`, and `PartialEq`
|
implemented for them. The additional traits of `Debug, `Eq`, `Hash`, and
|
||||||
can be enabled with the *extra_traits* feature (requires Rust 1.25 or newer):
|
`PartialEq` can be enabled with the *extra_traits* feature (requires Rust 1.25
|
||||||
|
or newer):
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
@ -39,7 +39,7 @@ macro_rules! s {
|
||||||
__item! {
|
__item! {
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
$(#[$attr])*
|
$(#[$attr])*
|
||||||
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, PartialEq))]
|
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
|
||||||
pub $t $i { $($field)* }
|
pub $t $i { $($field)* }
|
||||||
}
|
}
|
||||||
impl ::dox::Copy for $i {}
|
impl ::dox::Copy for $i {}
|
||||||
|
|
|
@ -73,6 +73,13 @@ impl std::fmt::Debug for pthread_attr_t {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for pthread_attr_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.__sig.hash(state);
|
||||||
|
self.__opaque.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub const __PTHREAD_MUTEX_SIZE__: usize = 40;
|
pub const __PTHREAD_MUTEX_SIZE__: usize = 40;
|
||||||
pub const __PTHREAD_COND_SIZE__: usize = 24;
|
pub const __PTHREAD_COND_SIZE__: usize = 24;
|
||||||
|
|
|
@ -78,6 +78,13 @@ impl std::fmt::Debug for pthread_attr_t {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for pthread_attr_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.__sig.hash(state);
|
||||||
|
self.__opaque.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub const __PTHREAD_MUTEX_SIZE__: usize = 56;
|
pub const __PTHREAD_MUTEX_SIZE__: usize = 56;
|
||||||
pub const __PTHREAD_COND_SIZE__: usize = 40;
|
pub const __PTHREAD_COND_SIZE__: usize = 40;
|
||||||
|
|
|
@ -608,6 +608,12 @@ impl std::fmt::Debug for semun {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for semun {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
unsafe { self.val.hash(state) };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for proc_threadinfo {
|
impl PartialEq for proc_threadinfo {
|
||||||
fn eq(&self, other: &proc_threadinfo) -> bool {
|
fn eq(&self, other: &proc_threadinfo) -> bool {
|
||||||
self.pth_user_time == other.pth_user_time
|
self.pth_user_time == other.pth_user_time
|
||||||
|
@ -648,6 +654,22 @@ impl std::fmt::Debug for proc_threadinfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for proc_threadinfo {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.pth_user_time.hash(state);
|
||||||
|
self.pth_system_time.hash(state);
|
||||||
|
self.pth_cpu_usage.hash(state);
|
||||||
|
self.pth_policy.hash(state);
|
||||||
|
self.pth_run_state.hash(state);
|
||||||
|
self.pth_flags.hash(state);
|
||||||
|
self.pth_sleep_time.hash(state);
|
||||||
|
self.pth_curpri.hash(state);
|
||||||
|
self.pth_priority.hash(state);
|
||||||
|
self.pth_maxpriority.hash(state);
|
||||||
|
self.pth_name.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for statfs {
|
impl PartialEq for statfs {
|
||||||
fn eq(&self, other: &statfs) -> bool {
|
fn eq(&self, other: &statfs) -> bool {
|
||||||
self.f_bsize == other.f_bsize
|
self.f_bsize == other.f_bsize
|
||||||
|
@ -702,6 +724,27 @@ impl std::fmt::Debug for statfs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for statfs {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.f_bsize.hash(state);
|
||||||
|
self.f_iosize.hash(state);
|
||||||
|
self.f_blocks.hash(state);
|
||||||
|
self.f_bfree.hash(state);
|
||||||
|
self.f_bavail.hash(state);
|
||||||
|
self.f_files.hash(state);
|
||||||
|
self.f_ffree.hash(state);
|
||||||
|
self.f_fsid.hash(state);
|
||||||
|
self.f_owner.hash(state);
|
||||||
|
self.f_flags.hash(state);
|
||||||
|
self.f_fssubtype.hash(state);
|
||||||
|
self.f_fstypename.hash(state);
|
||||||
|
self.f_type.hash(state);
|
||||||
|
self.f_mntonname.hash(state);
|
||||||
|
self.f_mntfromname.hash(state);
|
||||||
|
self.f_reserved.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for dirent {
|
impl PartialEq for dirent {
|
||||||
fn eq(&self, other: &dirent) -> bool {
|
fn eq(&self, other: &dirent) -> bool {
|
||||||
self.d_ino == other.d_ino
|
self.d_ino == other.d_ino
|
||||||
|
@ -732,6 +775,17 @@ impl std::fmt::Debug for dirent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for dirent {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.d_ino.hash(state);
|
||||||
|
self.d_seekoff.hash(state);
|
||||||
|
self.d_reclen.hash(state);
|
||||||
|
self.d_namlen.hash(state);
|
||||||
|
self.d_type.hash(state);
|
||||||
|
self.d_name.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for pthread_rwlock_t {
|
impl PartialEq for pthread_rwlock_t {
|
||||||
fn eq(&self, other: &pthread_rwlock_t) -> bool {
|
fn eq(&self, other: &pthread_rwlock_t) -> bool {
|
||||||
self.__sig == other.__sig
|
self.__sig == other.__sig
|
||||||
|
@ -754,6 +808,13 @@ impl std::fmt::Debug for pthread_rwlock_t {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for pthread_rwlock_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.__sig.hash(state);
|
||||||
|
self.__opaque.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for pthread_mutex_t {
|
impl PartialEq for pthread_mutex_t {
|
||||||
fn eq(&self, other: &pthread_mutex_t) -> bool {
|
fn eq(&self, other: &pthread_mutex_t) -> bool {
|
||||||
self.__sig == other.__sig
|
self.__sig == other.__sig
|
||||||
|
@ -776,6 +837,13 @@ impl std::fmt::Debug for pthread_mutex_t {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for pthread_mutex_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.__sig.hash(state);
|
||||||
|
self.__opaque.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for pthread_cond_t {
|
impl PartialEq for pthread_cond_t {
|
||||||
fn eq(&self, other: &pthread_cond_t) -> bool {
|
fn eq(&self, other: &pthread_cond_t) -> bool {
|
||||||
self.__sig == other.__sig
|
self.__sig == other.__sig
|
||||||
|
@ -798,6 +866,13 @@ impl std::fmt::Debug for pthread_cond_t {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for pthread_cond_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.__sig.hash(state);
|
||||||
|
self.__opaque.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for sockaddr_storage {
|
impl PartialEq for sockaddr_storage {
|
||||||
fn eq(&self, other: &sockaddr_storage) -> bool {
|
fn eq(&self, other: &sockaddr_storage) -> bool {
|
||||||
self.ss_len == other.ss_len
|
self.ss_len == other.ss_len
|
||||||
|
@ -830,6 +905,16 @@ impl std::fmt::Debug for sockaddr_storage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for sockaddr_storage {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.ss_len.hash(state);
|
||||||
|
self.ss_family.hash(state);
|
||||||
|
self.__ss_pad1.hash(state);
|
||||||
|
self.__ss_align.hash(state);
|
||||||
|
self.__ss_pad2.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for utmpx {
|
impl PartialEq for utmpx {
|
||||||
fn eq(&self, other: &utmpx) -> bool {
|
fn eq(&self, other: &utmpx) -> bool {
|
||||||
self.ut_user
|
self.ut_user
|
||||||
|
@ -866,6 +951,19 @@ impl std::fmt::Debug for utmpx {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for utmpx {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.ut_user.hash(state);
|
||||||
|
self.ut_id.hash(state);
|
||||||
|
self.ut_line.hash(state);
|
||||||
|
self.ut_pid.hash(state);
|
||||||
|
self.ut_type.hash(state);
|
||||||
|
self.ut_tv.hash(state);
|
||||||
|
self.ut_host.hash(state);
|
||||||
|
self.ut_pad.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub const _UTX_USERSIZE: usize = 256;
|
pub const _UTX_USERSIZE: usize = 256;
|
||||||
pub const _UTX_LINESIZE: usize = 32;
|
pub const _UTX_LINESIZE: usize = 32;
|
||||||
|
|
|
@ -162,6 +162,14 @@ impl std::fmt::Debug for sockaddr_un {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for sockaddr_un {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.sun_len.hash(state);
|
||||||
|
self.sun_family.hash(state);
|
||||||
|
self.sun_path.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for utsname {
|
impl PartialEq for utsname {
|
||||||
fn eq(&self, other: &utsname) -> bool {
|
fn eq(&self, other: &utsname) -> bool {
|
||||||
self.sysname
|
self.sysname
|
||||||
|
@ -204,6 +212,16 @@ impl std::fmt::Debug for utsname {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for utsname {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.sysname.hash(state);
|
||||||
|
self.nodename.hash(state);
|
||||||
|
self.release.hash(state);
|
||||||
|
self.version.hash(state);
|
||||||
|
self.machine.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub const LC_ALL: ::c_int = 0;
|
pub const LC_ALL: ::c_int = 0;
|
||||||
pub const LC_COLLATE: ::c_int = 1;
|
pub const LC_COLLATE: ::c_int = 1;
|
||||||
|
|
|
@ -150,6 +150,13 @@ impl std::fmt::Debug for pthread_mutex_t {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for pthread_mutex_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.value.hash(state);
|
||||||
|
self.__reserved.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for pthread_cond_t {
|
impl PartialEq for pthread_cond_t {
|
||||||
fn eq(&self, other: &pthread_cond_t) -> bool {
|
fn eq(&self, other: &pthread_cond_t) -> bool {
|
||||||
self.value == other.value
|
self.value == other.value
|
||||||
|
@ -172,6 +179,13 @@ impl std::fmt::Debug for pthread_cond_t {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for pthread_cond_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.value.hash(state);
|
||||||
|
self.__reserved.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for pthread_rwlock_t {
|
impl PartialEq for pthread_rwlock_t {
|
||||||
fn eq(&self, other: &pthread_rwlock_t) -> bool {
|
fn eq(&self, other: &pthread_rwlock_t) -> bool {
|
||||||
self.numLocks == other.numLocks
|
self.numLocks == other.numLocks
|
||||||
|
@ -201,6 +215,17 @@ impl std::fmt::Debug for pthread_rwlock_t {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for pthread_rwlock_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.numLocks.hash(state);
|
||||||
|
self.writerThreadId.hash(state);
|
||||||
|
self.pendingReaders.hash(state);
|
||||||
|
self.pendingWriters.hash(state);
|
||||||
|
self.attr.hash(state);
|
||||||
|
self.__reserved.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub const RTLD_GLOBAL: ::c_int = 0x00100;
|
pub const RTLD_GLOBAL: ::c_int = 0x00100;
|
||||||
pub const RTLD_NOW: ::c_int = 2;
|
pub const RTLD_NOW: ::c_int = 2;
|
||||||
|
|
|
@ -269,6 +269,16 @@ impl std::fmt::Debug for dirent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for dirent {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.d_ino.hash(state);
|
||||||
|
self.d_off.hash(state);
|
||||||
|
self.d_reclen.hash(state);
|
||||||
|
self.d_type.hash(state);
|
||||||
|
self.d_name.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for dirent64 {
|
impl PartialEq for dirent64 {
|
||||||
fn eq(&self, other: &dirent64) -> bool {
|
fn eq(&self, other: &dirent64) -> bool {
|
||||||
self.d_ino == other.d_ino
|
self.d_ino == other.d_ino
|
||||||
|
@ -297,6 +307,16 @@ impl std::fmt::Debug for dirent64 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for dirent64 {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.d_ino.hash(state);
|
||||||
|
self.d_off.hash(state);
|
||||||
|
self.d_reclen.hash(state);
|
||||||
|
self.d_type.hash(state);
|
||||||
|
self.d_name.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for siginfo_t {
|
impl PartialEq for siginfo_t {
|
||||||
fn eq(&self, other: &siginfo_t) -> bool {
|
fn eq(&self, other: &siginfo_t) -> bool {
|
||||||
self.si_signo == other.si_signo
|
self.si_signo == other.si_signo
|
||||||
|
@ -321,6 +341,16 @@ impl std::fmt::Debug for siginfo_t {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for siginfo_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.si_signo.hash(state);
|
||||||
|
self.si_errno.hash(state);
|
||||||
|
self.si_code.hash(state);
|
||||||
|
// Ignore _pad
|
||||||
|
// Ignore _align
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for lastlog {
|
impl PartialEq for lastlog {
|
||||||
fn eq(&self, other: &lastlog) -> bool {
|
fn eq(&self, other: &lastlog) -> bool {
|
||||||
self.ll_time == other.ll_time
|
self.ll_time == other.ll_time
|
||||||
|
@ -349,6 +379,14 @@ impl std::fmt::Debug for lastlog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for lastlog {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.ll_time.hash(state);
|
||||||
|
self.ll_line.hash(state);
|
||||||
|
self.ll_host.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for utmp {
|
impl PartialEq for utmp {
|
||||||
fn eq(&self, other: &utmp) -> bool {
|
fn eq(&self, other: &utmp) -> bool {
|
||||||
self.ut_type == other.ut_type
|
self.ut_type == other.ut_type
|
||||||
|
@ -396,6 +434,22 @@ impl std::fmt::Debug for utmp {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for utmp {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.ut_type.hash(state);
|
||||||
|
self.ut_pid.hash(state);
|
||||||
|
self.ut_line.hash(state);
|
||||||
|
self.ut_id.hash(state);
|
||||||
|
self.ut_user.hash(state);
|
||||||
|
self.ut_host.hash(state);
|
||||||
|
self.ut_exit.hash(state);
|
||||||
|
self.ut_session.hash(state);
|
||||||
|
self.ut_tv.hash(state);
|
||||||
|
self.ut_addr_v6.hash(state);
|
||||||
|
self.unused.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub const O_TRUNC: ::c_int = 512;
|
pub const O_TRUNC: ::c_int = 512;
|
||||||
pub const O_CLOEXEC: ::c_int = 0x80000;
|
pub const O_CLOEXEC: ::c_int = 0x80000;
|
||||||
|
|
|
@ -687,6 +687,16 @@ impl std::fmt::Debug for dirent {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for dirent {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.d_ino.hash(state);
|
||||||
|
self.d_off.hash(state);
|
||||||
|
self.d_reclen.hash(state);
|
||||||
|
self.d_type.hash(state);
|
||||||
|
self.d_name.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for dirent64 {
|
impl PartialEq for dirent64 {
|
||||||
|
@ -716,6 +726,16 @@ impl std::fmt::Debug for dirent64 {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for dirent64 {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.d_ino.hash(state);
|
||||||
|
self.d_off.hash(state);
|
||||||
|
self.d_reclen.hash(state);
|
||||||
|
self.d_type.hash(state);
|
||||||
|
self.d_name.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for pthread_cond_t {
|
impl PartialEq for pthread_cond_t {
|
||||||
|
@ -733,6 +753,12 @@ impl std::fmt::Debug for pthread_cond_t {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for pthread_cond_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.size.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for pthread_mutex_t {
|
impl PartialEq for pthread_mutex_t {
|
||||||
|
@ -750,6 +776,12 @@ impl std::fmt::Debug for pthread_mutex_t {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for pthread_mutex_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.size.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for pthread_rwlock_t {
|
impl PartialEq for pthread_rwlock_t {
|
||||||
|
@ -767,6 +799,12 @@ impl std::fmt::Debug for pthread_rwlock_t {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for pthread_rwlock_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.size.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub const ABDAY_1: ::nl_item = 0x20000;
|
pub const ABDAY_1: ::nl_item = 0x20000;
|
||||||
pub const ABDAY_2: ::nl_item = 0x20001;
|
pub const ABDAY_2: ::nl_item = 0x20001;
|
||||||
|
|
|
@ -207,6 +207,17 @@ impl std::fmt::Debug for ucontext_t {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for ucontext_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.uc_flags.hash(state);
|
||||||
|
self.uc_link.hash(state);
|
||||||
|
self.uc_stack.hash(state);
|
||||||
|
self.uc_mcontext.hash(state);
|
||||||
|
self.uc_sigmask.hash(state);
|
||||||
|
self.__private.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub const SIGSTKSZ: ::size_t = 8192;
|
pub const SIGSTKSZ: ::size_t = 8192;
|
||||||
pub const MINSIGSTKSZ: ::size_t = 2048;
|
pub const MINSIGSTKSZ: ::size_t = 2048;
|
||||||
|
|
|
@ -105,6 +105,17 @@ impl std::fmt::Debug for ucontext_t {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for ucontext_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.uc_flags.hash(state);
|
||||||
|
self.uc_link.hash(state);
|
||||||
|
self.uc_stack.hash(state);
|
||||||
|
self.uc_mcontext.hash(state);
|
||||||
|
self.uc_sigmask.hash(state);
|
||||||
|
self.__private.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Syscall table
|
// Syscall table
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,25 @@ impl std::fmt::Debug for sysinfo {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for sysinfo {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.uptime.hash(state);
|
||||||
|
self.loads.hash(state);
|
||||||
|
self.totalram.hash(state);
|
||||||
|
self.freeram.hash(state);
|
||||||
|
self.sharedram.hash(state);
|
||||||
|
self.bufferram.hash(state);
|
||||||
|
self.totalswap.hash(state);
|
||||||
|
self.freeswap.hash(state);
|
||||||
|
self.procs.hash(state);
|
||||||
|
self.pad.hash(state);
|
||||||
|
self.totalhigh.hash(state);
|
||||||
|
self.freehigh.hash(state);
|
||||||
|
self.mem_unit.hash(state);
|
||||||
|
self.__reserved.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub const SFD_CLOEXEC: ::c_int = 0x080000;
|
pub const SFD_CLOEXEC: ::c_int = 0x080000;
|
||||||
|
|
||||||
|
|
|
@ -256,6 +256,24 @@ impl std::fmt::Debug for user_fpxregs_struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for user_fpxregs_struct {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.cwd.hash(state);
|
||||||
|
self.swd.hash(state);
|
||||||
|
self.twd.hash(state);
|
||||||
|
self.fop.hash(state);
|
||||||
|
self.fip.hash(state);
|
||||||
|
self.fcs.hash(state);
|
||||||
|
self.foo.hash(state);
|
||||||
|
self.fos.hash(state);
|
||||||
|
self.mxcsr.hash(state);
|
||||||
|
// Ignore __reserved field
|
||||||
|
self.st_space.hash(state);
|
||||||
|
self.xmm_space.hash(state);
|
||||||
|
// Ignore padding field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for ucontext_t {
|
impl PartialEq for ucontext_t {
|
||||||
fn eq(&self, other: &ucontext_t) -> bool {
|
fn eq(&self, other: &ucontext_t) -> bool {
|
||||||
self.uc_flags == other.uc_flags
|
self.uc_flags == other.uc_flags
|
||||||
|
@ -281,6 +299,17 @@ impl std::fmt::Debug for ucontext_t {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for ucontext_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.uc_flags.hash(state);
|
||||||
|
self.uc_link.hash(state);
|
||||||
|
self.uc_stack.hash(state);
|
||||||
|
self.uc_mcontext.hash(state);
|
||||||
|
self.uc_sigmask.hash(state);
|
||||||
|
// Ignore __private field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub const O_DIRECT: ::c_int = 0x4000;
|
pub const O_DIRECT: ::c_int = 0x4000;
|
||||||
pub const O_DIRECTORY: ::c_int = 0x10000;
|
pub const O_DIRECTORY: ::c_int = 0x10000;
|
||||||
|
|
|
@ -273,6 +273,21 @@ impl std::fmt::Debug for user_fpregs_struct {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for user_fpregs_struct {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.cwd.hash(state);
|
||||||
|
self.ftw.hash(state);
|
||||||
|
self.fop.hash(state);
|
||||||
|
self.rip.hash(state);
|
||||||
|
self.rdp.hash(state);
|
||||||
|
self.mxcsr.hash(state);
|
||||||
|
self.mxcr_mask.hash(state);
|
||||||
|
self.st_space.hash(state);
|
||||||
|
self.xmm_space.hash(state);
|
||||||
|
// Ignore padding field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for ucontext_t {
|
impl PartialEq for ucontext_t {
|
||||||
|
@ -300,6 +315,17 @@ impl std::fmt::Debug for ucontext_t {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for ucontext_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.uc_flags.hash(state);
|
||||||
|
self.uc_link.hash(state);
|
||||||
|
self.uc_stack.hash(state);
|
||||||
|
self.uc_mcontext.hash(state);
|
||||||
|
self.uc_sigmask.hash(state);
|
||||||
|
// Ignore __private field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub const TIOCGSOFTCAR: ::c_ulong = 0x5419;
|
pub const TIOCGSOFTCAR: ::c_ulong = 0x5419;
|
||||||
pub const TIOCSSOFTCAR: ::c_ulong = 0x541A;
|
pub const TIOCSSOFTCAR: ::c_ulong = 0x541A;
|
||||||
|
|
|
@ -286,6 +286,22 @@ impl std::fmt::Debug for utmpx {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for utmpx {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.ut_type.hash(state);
|
||||||
|
self.ut_pid.hash(state);
|
||||||
|
self.ut_line.hash(state);
|
||||||
|
self.ut_id.hash(state);
|
||||||
|
self.ut_user.hash(state);
|
||||||
|
self.ut_host.hash(state);
|
||||||
|
self.ut_exit.hash(state);
|
||||||
|
self.ut_session.hash(state);
|
||||||
|
self.ut_tv.hash(state);
|
||||||
|
self.ut_addr_v6.hash(state);
|
||||||
|
self.__glibc_reserved.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub const __UT_LINESIZE: usize = 32;
|
pub const __UT_LINESIZE: usize = 32;
|
||||||
pub const __UT_NAMESIZE: usize = 32;
|
pub const __UT_NAMESIZE: usize = 32;
|
||||||
|
|
|
@ -352,6 +352,12 @@ impl std::fmt::Debug for fpreg_t {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for fpreg_t {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.d.to_bits().hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub const SFD_CLOEXEC: ::c_int = 0x080000;
|
pub const SFD_CLOEXEC: ::c_int = 0x080000;
|
||||||
|
|
||||||
|
|
|
@ -254,6 +254,13 @@ impl std::fmt::Debug for sockaddr_un {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for sockaddr_un {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.sun_family.hash(state);
|
||||||
|
self.sun_path.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for sockaddr_storage {
|
impl PartialEq for sockaddr_storage {
|
||||||
|
@ -278,6 +285,13 @@ impl std::fmt::Debug for sockaddr_storage {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for sockaddr_storage {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.ss_family.hash(state);
|
||||||
|
self.__ss_pad2.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "extra_traits")]
|
#[cfg(feature = "extra_traits")]
|
||||||
impl PartialEq for utsname {
|
impl PartialEq for utsname {
|
||||||
|
@ -328,6 +342,17 @@ impl std::fmt::Debug for utsname {
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "extra_traits")]
|
||||||
|
impl std::hash::Hash for utsname {
|
||||||
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||||
|
self.sysname.hash(state);
|
||||||
|
self.nodename.hash(state);
|
||||||
|
self.release.hash(state);
|
||||||
|
self.version.hash(state);
|
||||||
|
self.machine.hash(state);
|
||||||
|
self.domainname.hash(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// intentionally not public, only used for fd_set
|
// intentionally not public, only used for fd_set
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
|
|
Loading…
Reference in New Issue