Skip to content

Commit 05caeab

Browse files
committed
[breaking change] sockaddr_nl is not available on emscripten
1 parent 5ede8aa commit 05caeab

File tree

3 files changed

+64
-32
lines changed

3 files changed

+64
-32
lines changed

src/unix/notbsd/android/mod.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@ s! {
201201
}
202202

203203
s_no_extra_traits!{
204+
pub struct sockaddr_nl {
205+
pub nl_family: ::sa_family_t,
206+
nl_pad: ::c_ushort,
207+
pub nl_pid: u32,
208+
pub nl_groups: u32
209+
}
210+
204211
pub struct dirent {
205212
pub d_ino: u64,
206213
pub d_off: i64,
@@ -261,6 +268,31 @@ s_no_extra_traits!{
261268

262269
cfg_if! {
263270
if #[cfg(feature = "extra_traits")] {
271+
impl PartialEq for sockaddr_nl {
272+
fn eq(&self, other: &sockaddr_nl) -> bool {
273+
self.nl_family == other.nl_family &&
274+
self.nl_pid == other.nl_pid &&
275+
self.nl_groups == other.nl_groups
276+
}
277+
}
278+
impl Eq for sockaddr_nl {}
279+
impl ::fmt::Debug for sockaddr_nl {
280+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
281+
f.debug_struct("sockaddr_nl")
282+
.field("nl_family", &self.nl_family)
283+
.field("nl_pid", &self.nl_pid)
284+
.field("nl_groups", &self.nl_groups)
285+
.finish()
286+
}
287+
}
288+
impl ::hash::Hash for sockaddr_nl {
289+
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
290+
self.nl_family.hash(state);
291+
self.nl_pid.hash(state);
292+
self.nl_groups.hash(state);
293+
}
294+
}
295+
264296
impl PartialEq for dirent {
265297
fn eq(&self, other: &dirent) -> bool {
266298
self.d_ino == other.d_ino

src/unix/notbsd/linux/mod.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,13 @@ s! {
477477
}
478478

479479
s_no_extra_traits!{
480+
pub struct sockaddr_nl {
481+
pub nl_family: ::sa_family_t,
482+
nl_pad: ::c_ushort,
483+
pub nl_pid: u32,
484+
pub nl_groups: u32
485+
}
486+
480487
pub struct dirent {
481488
pub d_ino: ::ino_t,
482489
pub d_off: ::off_t,
@@ -535,6 +542,31 @@ s_no_extra_traits!{
535542

536543
cfg_if! {
537544
if #[cfg(feature = "extra_traits")] {
545+
impl PartialEq for sockaddr_nl {
546+
fn eq(&self, other: &sockaddr_nl) -> bool {
547+
self.nl_family == other.nl_family &&
548+
self.nl_pid == other.nl_pid &&
549+
self.nl_groups == other.nl_groups
550+
}
551+
}
552+
impl Eq for sockaddr_nl {}
553+
impl ::fmt::Debug for sockaddr_nl {
554+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
555+
f.debug_struct("sockaddr_nl")
556+
.field("nl_family", &self.nl_family)
557+
.field("nl_pid", &self.nl_pid)
558+
.field("nl_groups", &self.nl_groups)
559+
.finish()
560+
}
561+
}
562+
impl ::hash::Hash for sockaddr_nl {
563+
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
564+
self.nl_family.hash(state);
565+
self.nl_pid.hash(state);
566+
self.nl_groups.hash(state);
567+
}
568+
}
569+
538570
impl PartialEq for dirent {
539571
fn eq(&self, other: &dirent) -> bool {
540572
self.d_ino == other.d_ino

src/unix/notbsd/mod.rs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,6 @@ s_no_extra_traits!{
242242
pub machine: [::c_char; 65],
243243
pub domainname: [::c_char; 65]
244244
}
245-
246-
pub struct sockaddr_nl {
247-
pub nl_family: ::sa_family_t,
248-
nl_pad: ::c_ushort,
249-
pub nl_pid: u32,
250-
pub nl_groups: u32
251-
}
252245
}
253246

254247
cfg_if! {
@@ -394,31 +387,6 @@ cfg_if! {
394387
self.domainname.hash(state);
395388
}
396389
}
397-
398-
impl PartialEq for sockaddr_nl {
399-
fn eq(&self, other: &sockaddr_nl) -> bool {
400-
self.nl_family == other.nl_family &&
401-
self.nl_pid == other.nl_pid &&
402-
self.nl_groups == other.nl_groups
403-
}
404-
}
405-
impl Eq for sockaddr_nl {}
406-
impl ::fmt::Debug for sockaddr_nl {
407-
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
408-
f.debug_struct("sockaddr_nl")
409-
.field("nl_family", &self.nl_family)
410-
.field("nl_pid", &self.nl_pid)
411-
.field("nl_groups", &self.nl_groups)
412-
.finish()
413-
}
414-
}
415-
impl ::hash::Hash for sockaddr_nl {
416-
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
417-
self.nl_family.hash(state);
418-
self.nl_pid.hash(state);
419-
self.nl_groups.hash(state);
420-
}
421-
}
422390
}
423391
}
424392

0 commit comments

Comments
 (0)