Skip to content

Commit 7c8de34

Browse files
author
Eric Reed
committed
---
yaml --- r: 66029 b: refs/heads/master c: 4744375 h: refs/heads/master i: 66027: eba0fcd v: v3
1 parent 54bece3 commit 7c8de34

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 7e022c590fb0fb6083be7825df90045505e6fe47
2+
refs/heads/master: 47443753f1197877f51f4a66d3475f8c9e4d5bc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/src/libstd/rt/io/net/ip.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,28 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
use std::cmp::{Eq, TotalEq, eq};
12+
1113
pub enum IpAddr {
1214
Ipv4(u8, u8, u8, u8, u16),
1315
Ipv6
1416
}
17+
18+
impl Eq for IpAddr {
19+
fn eq(&self, other: &IpAddr) -> bool {
20+
match (*self, *other) {
21+
(Ipv4(a,b,c,d,e), Ipv4(f,g,h,i,j)) => a == f && b == g && c == h && d == i && e == j,
22+
(Ipv6, Ipv6) => fail!(),
23+
_ => false
24+
}
25+
}
26+
fn ne(&self, other: &IpAddr) -> bool {
27+
!eq(self, other)
28+
}
29+
}
30+
31+
impl TotalEq for IpAddr {
32+
fn equals(&self, other: &IpAddr) -> bool {
33+
*self == *other
34+
}
35+
}

0 commit comments

Comments
 (0)