@@ -60,7 +60,7 @@ pub enum Ipv6MulticastScope {
6060impl Ipv4Addr {
6161 /// Creates a new IPv4 address from four eight-bit octets.
6262 ///
63- /// The result will represent the IP address a.b.c.d
63+ /// The result will represent the IP address `a`.`b`.`c`.`d`.
6464 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
6565 pub fn new ( a : u8 , b : u8 , c : u8 , d : u8 ) -> Ipv4Addr {
6666 Ipv4Addr {
@@ -73,19 +73,19 @@ impl Ipv4Addr {
7373 }
7474 }
7575
76- /// Returns the four eight-bit integers that make up this address
76+ /// Returns the four eight-bit integers that make up this address.
7777 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
7878 pub fn octets ( & self ) -> [ u8 ; 4 ] {
7979 let bits = ntoh ( self . inner . s_addr ) ;
8080 [ ( bits >> 24 ) as u8 , ( bits >> 16 ) as u8 , ( bits >> 8 ) as u8 , bits as u8 ]
8181 }
8282
83- /// Returns true for the special 'unspecified' address 0.0.0.0
83+ /// Returns true for the special 'unspecified' address 0.0.0.0.
8484 pub fn is_unspecified ( & self ) -> bool {
8585 self . inner . s_addr == 0
8686 }
8787
88- /// Returns true if this is a loopback address (127.0.0.0/8)
88+ /// Returns true if this is a loopback address (127.0.0.0/8).
8989 pub fn is_loopback ( & self ) -> bool {
9090 self . octets ( ) [ 0 ] == 127
9191 }
@@ -106,7 +106,7 @@ impl Ipv4Addr {
106106 }
107107 }
108108
109- /// Returns true if the address is link-local (169.254.0.0/16)
109+ /// Returns true if the address is link-local (169.254.0.0/16).
110110 pub fn is_link_local ( & self ) -> bool {
111111 self . octets ( ) [ 0 ] == 169 && self . octets ( ) [ 1 ] == 254
112112 }
@@ -116,7 +116,7 @@ impl Ipv4Addr {
116116 /// Non-globally-routable networks include the private networks (10.0.0.0/8,
117117 /// 172.16.0.0/12 and 192.168.0.0/16), the loopback network (127.0.0.0/8),
118118 /// the link-local network (169.254.0.0/16), the broadcast address (255.255.255.255/32) and
119- /// the test networks used for documentation (192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24)
119+ /// the test networks used for documentation (192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24).
120120 pub fn is_global ( & self ) -> bool {
121121 !self . is_private ( ) && !self . is_loopback ( ) && !self . is_link_local ( ) &&
122122 !self . is_broadcast ( ) && !self . is_documentation ( )
@@ -131,13 +131,13 @@ impl Ipv4Addr {
131131
132132 /// Returns true if this is a broadcast address.
133133 ///
134- /// A broadcast address has all octets set to 255 as defined in RFC 919
134+ /// A broadcast address has all octets set to 255 as defined in RFC 919.
135135 pub fn is_broadcast ( & self ) -> bool {
136136 self . octets ( ) [ 0 ] == 255 && self . octets ( ) [ 1 ] == 255 &&
137137 self . octets ( ) [ 2 ] == 255 && self . octets ( ) [ 3 ] == 255
138138 }
139139
140- /// Returns true if this address is in a range designated for documentation
140+ /// Returns true if this address is in a range designated for documentation.
141141 ///
142142 /// This is defined in RFC 5737
143143 /// - 192.0.2.0/24 (TEST-NET-1)
@@ -152,7 +152,7 @@ impl Ipv4Addr {
152152 }
153153 }
154154
155- /// Converts this address to an IPv4-compatible IPv6 address
155+ /// Converts this address to an IPv4-compatible IPv6 address.
156156 ///
157157 /// a.b.c.d becomes ::a.b.c.d
158158 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -162,7 +162,7 @@ impl Ipv4Addr {
162162 ( ( self . octets ( ) [ 2 ] as u16 ) << 8 ) | self . octets ( ) [ 3 ] as u16 )
163163 }
164164
165- /// Converts this address to an IPv4-mapped IPv6 address
165+ /// Converts this address to an IPv4-mapped IPv6 address.
166166 ///
167167 /// a.b.c.d becomes ::ffff:a.b.c.d
168168 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -247,7 +247,7 @@ impl FromInner<libc::in_addr> for Ipv4Addr {
247247impl Ipv6Addr {
248248 /// Creates a new IPv6 address from eight 16-bit segments.
249249 ///
250- /// The result will represent the IP address a:b:c:d:e:f:g:h
250+ /// The result will represent the IP address a:b:c:d:e:f:g:h.
251251 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
252252 pub fn new ( a : u16 , b : u16 , c : u16 , d : u16 , e : u16 , f : u16 , g : u16 ,
253253 h : u16 ) -> Ipv6Addr {
@@ -259,7 +259,7 @@ impl Ipv6Addr {
259259 }
260260 }
261261
262- /// Returns the eight 16-bit segments that make up this address
262+ /// Returns the eight 16-bit segments that make up this address.
263263 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
264264 pub fn segments ( & self ) -> [ u16 ; 8 ] {
265265 [ ntoh ( self . inner . s6_addr [ 0 ] ) ,
@@ -272,12 +272,12 @@ impl Ipv6Addr {
272272 ntoh ( self . inner . s6_addr [ 7 ] ) ]
273273 }
274274
275- /// Returns true for the special 'unspecified' address ::
275+ /// Returns true for the special 'unspecified' address ::.
276276 pub fn is_unspecified ( & self ) -> bool {
277277 self . segments ( ) == [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ]
278278 }
279279
280- /// Returns true if this is a loopback address (::1)
280+ /// Returns true if this is a loopback address (::1).
281281 pub fn is_loopback ( & self ) -> bool {
282282 self . segments ( ) == [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 ]
283283 }
@@ -295,25 +295,25 @@ impl Ipv6Addr {
295295 }
296296 }
297297
298- /// Returns true if this is a unique local address (IPv6)
298+ /// Returns true if this is a unique local address (IPv6).
299299 ///
300- /// Unique local addresses are defined in RFC4193 and have the form fc00::/7
300+ /// Unique local addresses are defined in RFC4193 and have the form fc00::/7.
301301 pub fn is_unique_local ( & self ) -> bool {
302302 ( self . segments ( ) [ 0 ] & 0xfe00 ) == 0xfc00
303303 }
304304
305- /// Returns true if the address is unicast and link-local (fe80::/10)
305+ /// Returns true if the address is unicast and link-local (fe80::/10).
306306 pub fn is_unicast_link_local ( & self ) -> bool {
307307 ( self . segments ( ) [ 0 ] & 0xffc0 ) == 0xfe80
308308 }
309309
310310 /// Returns true if this is a deprecated unicast site-local address (IPv6
311- /// fec0::/10)
311+ /// fec0::/10).
312312 pub fn is_unicast_site_local ( & self ) -> bool {
313313 ( self . segments ( ) [ 0 ] & 0xffc0 ) == 0xfec0
314314 }
315315
316- /// Returns true if the address is a globally routable unicast address
316+ /// Returns true if the address is a globally routable unicast address.
317317 ///
318318 /// Non-globally-routable unicast addresses include the loopback address,
319319 /// the link-local addresses, the deprecated site-local addresses and the
0 commit comments