@@ -176,8 +176,9 @@ impl Ipv4Addr {
176
176
/// Returns true for the special 'unspecified' address (0.0.0.0).
177
177
///
178
178
/// This property is defined in _UNIX Network Programming, Second Edition_,
179
- /// W. Richard Stevens, p. 891; see also [ip7]
180
- /// [ip7][http://man7.org/linux/man-pages/man7/ip.7.html]
179
+ /// W. Richard Stevens, p. 891; see also [ip7].
180
+ ///
181
+ /// [ip7]: (http://man7.org/linux/man-pages/man7/ip.7.html)
181
182
#[ stable( feature = "ip_shared" , since = "1.12.0" ) ]
182
183
pub fn is_unspecified ( & self ) -> bool {
183
184
self . inner . s_addr == 0
@@ -186,6 +187,7 @@ impl Ipv4Addr {
186
187
/// Returns true if this is a loopback address (127.0.0.0/8).
187
188
///
188
189
/// This property is defined by [RFC 1122].
190
+ ///
189
191
/// [RFC 1122]: https://tools.ietf.org/html/rfc1122
190
192
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
191
193
pub fn is_loopback ( & self ) -> bool {
@@ -195,11 +197,12 @@ impl Ipv4Addr {
195
197
/// Returns true if this is a private address.
196
198
///
197
199
/// The private address ranges are defined in [RFC 1918] and include:
198
- /// [RFC 1918]: https://tools.ietf.org/html/rfc1918
199
200
///
200
201
/// - 10.0.0.0/8
201
202
/// - 172.16.0.0/12
202
203
/// - 192.168.0.0/16
204
+ ///
205
+ /// [RFC 1918]: https://tools.ietf.org/html/rfc1918
203
206
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
204
207
pub fn is_private ( & self ) -> bool {
205
208
match ( self . octets ( ) [ 0 ] , self . octets ( ) [ 1 ] ) {
@@ -213,6 +216,7 @@ impl Ipv4Addr {
213
216
/// Returns true if the address is link-local (169.254.0.0/16).
214
217
///
215
218
/// This property is defined by [RFC 3927].
219
+ ///
216
220
/// [RFC 3927]: https://tools.ietf.org/html/rfc3927
217
221
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
218
222
pub fn is_link_local ( & self ) -> bool {
@@ -221,7 +225,6 @@ impl Ipv4Addr {
221
225
222
226
/// Returns true if the address appears to be globally routable.
223
227
/// See [iana-ipv4-special-registry][ipv4-sr].
224
- /// [ipv4-sr]: http://goo.gl/RaZ7lg
225
228
///
226
229
/// The following return false:
227
230
///
@@ -231,6 +234,8 @@ impl Ipv4Addr {
231
234
/// - the broadcast address (255.255.255.255/32)
232
235
/// - test addresses used for documentation (192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24)
233
236
/// - the unspecified address (0.0.0.0)
237
+ ///
238
+ /// [ipv4-sr]: http://goo.gl/RaZ7lg
234
239
pub fn is_global ( & self ) -> bool {
235
240
!self . is_private ( ) && !self . is_loopback ( ) && !self . is_link_local ( ) &&
236
241
!self . is_broadcast ( ) && !self . is_documentation ( ) && !self . is_unspecified ( )
@@ -240,6 +245,7 @@ impl Ipv4Addr {
240
245
///
241
246
/// Multicast addresses have a most significant octet between 224 and 239,
242
247
/// and is defined by [RFC 5771].
248
+ ///
243
249
/// [RFC 5771]: https://tools.ietf.org/html/rfc5771
244
250
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
245
251
pub fn is_multicast ( & self ) -> bool {
@@ -249,6 +255,7 @@ impl Ipv4Addr {
249
255
/// Returns true if this is a broadcast address (255.255.255.255).
250
256
///
251
257
/// A broadcast address has all octets set to 255 as defined in [RFC 919].
258
+ ///
252
259
/// [RFC 919]: https://tools.ietf.org/html/rfc919
253
260
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
254
261
pub fn is_broadcast ( & self ) -> bool {
@@ -259,11 +266,12 @@ impl Ipv4Addr {
259
266
/// Returns true if this address is in a range designated for documentation.
260
267
///
261
268
/// This is defined in [RFC 5737]:
262
- /// [RFC 5737]: https://tools.ietf.org/html/rfc5737
263
269
///
264
270
/// - 192.0.2.0/24 (TEST-NET-1)
265
271
/// - 198.51.100.0/24 (TEST-NET-2)
266
272
/// - 203.0.113.0/24 (TEST-NET-3)
273
+ ///
274
+ /// [RFC 5737]: https://tools.ietf.org/html/rfc5737
267
275
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
268
276
pub fn is_documentation ( & self ) -> bool {
269
277
match ( self . octets ( ) [ 0 ] , self . octets ( ) [ 1 ] , self . octets ( ) [ 2 ] , self . octets ( ) [ 3 ] ) {
@@ -425,6 +433,7 @@ impl Ipv6Addr {
425
433
/// Returns true for the special 'unspecified' address (::).
426
434
///
427
435
/// This property is defined in [RFC 4291].
436
+ ///
428
437
/// [RFC 4291]: https://tools.ietf.org/html/rfc4291
429
438
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
430
439
pub fn is_unspecified ( & self ) -> bool {
@@ -434,6 +443,7 @@ impl Ipv6Addr {
434
443
/// Returns true if this is a loopback address (::1).
435
444
///
436
445
/// This property is defined in [RFC 4291].
446
+ ///
437
447
/// [RFC 4291]: https://tools.ietf.org/html/rfc4291
438
448
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
439
449
pub fn is_loopback ( & self ) -> bool {
@@ -458,6 +468,7 @@ impl Ipv6Addr {
458
468
/// Returns true if this is a unique local address (fc00::/7).
459
469
///
460
470
/// This property is defined in [RFC 4193].
471
+ ///
461
472
/// [RFC 4193]: https://tools.ietf.org/html/rfc4193
462
473
pub fn is_unique_local ( & self ) -> bool {
463
474
( self . segments ( ) [ 0 ] & 0xfe00 ) == 0xfc00
@@ -466,6 +477,7 @@ impl Ipv6Addr {
466
477
/// Returns true if the address is unicast and link-local (fe80::/10).
467
478
///
468
479
/// This property is defined in [RFC 4291].
480
+ ///
469
481
/// [RFC 4291]: https://tools.ietf.org/html/rfc4291
470
482
pub fn is_unicast_link_local ( & self ) -> bool {
471
483
( self . segments ( ) [ 0 ] & 0xffc0 ) == 0xfe80
@@ -481,6 +493,7 @@ impl Ipv6Addr {
481
493
/// (2001:db8::/32).
482
494
///
483
495
/// This property is defined in [RFC 3849].
496
+ ///
484
497
/// [RFC 3849]: https://tools.ietf.org/html/rfc3849
485
498
pub fn is_documentation ( & self ) -> bool {
486
499
( self . segments ( ) [ 0 ] == 0x2001 ) && ( self . segments ( ) [ 1 ] == 0xdb8 )
@@ -524,6 +537,7 @@ impl Ipv6Addr {
524
537
/// Returns true if this is a multicast address (ff00::/8).
525
538
///
526
539
/// This property is defined by [RFC 4291].
540
+ ///
527
541
/// [RFC 4291]: https://tools.ietf.org/html/rfc4291
528
542
#[ stable( since = "1.7.0" , feature = "ip_17" ) ]
529
543
pub fn is_multicast ( & self ) -> bool {
0 commit comments