[breaking change] sockaddr_nl is not available on emscripten

This commit is contained in:
gnzlbg 2019-05-28 13:23:22 +02:00
parent 5ede8aab94
commit 05caeabe91
3 changed files with 64 additions and 32 deletions

View File

@ -201,6 +201,13 @@ s! {
}
s_no_extra_traits!{
pub struct sockaddr_nl {
pub nl_family: ::sa_family_t,
nl_pad: ::c_ushort,
pub nl_pid: u32,
pub nl_groups: u32
}
pub struct dirent {
pub d_ino: u64,
pub d_off: i64,
@ -261,6 +268,31 @@ s_no_extra_traits!{
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for sockaddr_nl {
fn eq(&self, other: &sockaddr_nl) -> bool {
self.nl_family == other.nl_family &&
self.nl_pid == other.nl_pid &&
self.nl_groups == other.nl_groups
}
}
impl Eq for sockaddr_nl {}
impl ::fmt::Debug for sockaddr_nl {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("sockaddr_nl")
.field("nl_family", &self.nl_family)
.field("nl_pid", &self.nl_pid)
.field("nl_groups", &self.nl_groups)
.finish()
}
}
impl ::hash::Hash for sockaddr_nl {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.nl_family.hash(state);
self.nl_pid.hash(state);
self.nl_groups.hash(state);
}
}
impl PartialEq for dirent {
fn eq(&self, other: &dirent) -> bool {
self.d_ino == other.d_ino

View File

@ -477,6 +477,13 @@ s! {
}
s_no_extra_traits!{
pub struct sockaddr_nl {
pub nl_family: ::sa_family_t,
nl_pad: ::c_ushort,
pub nl_pid: u32,
pub nl_groups: u32
}
pub struct dirent {
pub d_ino: ::ino_t,
pub d_off: ::off_t,
@ -535,6 +542,31 @@ s_no_extra_traits!{
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for sockaddr_nl {
fn eq(&self, other: &sockaddr_nl) -> bool {
self.nl_family == other.nl_family &&
self.nl_pid == other.nl_pid &&
self.nl_groups == other.nl_groups
}
}
impl Eq for sockaddr_nl {}
impl ::fmt::Debug for sockaddr_nl {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("sockaddr_nl")
.field("nl_family", &self.nl_family)
.field("nl_pid", &self.nl_pid)
.field("nl_groups", &self.nl_groups)
.finish()
}
}
impl ::hash::Hash for sockaddr_nl {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.nl_family.hash(state);
self.nl_pid.hash(state);
self.nl_groups.hash(state);
}
}
impl PartialEq for dirent {
fn eq(&self, other: &dirent) -> bool {
self.d_ino == other.d_ino

View File

@ -242,13 +242,6 @@ s_no_extra_traits!{
pub machine: [::c_char; 65],
pub domainname: [::c_char; 65]
}
pub struct sockaddr_nl {
pub nl_family: ::sa_family_t,
nl_pad: ::c_ushort,
pub nl_pid: u32,
pub nl_groups: u32
}
}
cfg_if! {
@ -394,31 +387,6 @@ cfg_if! {
self.domainname.hash(state);
}
}
impl PartialEq for sockaddr_nl {
fn eq(&self, other: &sockaddr_nl) -> bool {
self.nl_family == other.nl_family &&
self.nl_pid == other.nl_pid &&
self.nl_groups == other.nl_groups
}
}
impl Eq for sockaddr_nl {}
impl ::fmt::Debug for sockaddr_nl {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("sockaddr_nl")
.field("nl_family", &self.nl_family)
.field("nl_pid", &self.nl_pid)
.field("nl_groups", &self.nl_groups)
.finish()
}
}
impl ::hash::Hash for sockaddr_nl {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.nl_family.hash(state);
self.nl_pid.hash(state);
self.nl_groups.hash(state);
}
}
}
}