]> git.lizzy.rs Git - rust.git/commitdiff
rollup merge of #24377: apasel422/docs
authorAlex Crichton <alex@alexcrichton.com>
Tue, 14 Apr 2015 17:56:57 +0000 (10:56 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 14 Apr 2015 17:56:57 +0000 (10:56 -0700)
Conflicts:
src/libstd/net/ip.rs
src/libstd/sys/unix/fs.rs
src/libstd/sys/unix/mod.rs
src/libstd/sys/windows/mod.rs

16 files changed:
1  2 
src/libcollections/string.rs
src/libcore/iter.rs
src/libcore/result.rs
src/libstd/collections/hash/map.rs
src/libstd/ffi/c_str.rs
src/libstd/ffi/os_str.rs
src/libstd/fs.rs
src/libstd/io/mod.rs
src/libstd/net/ip.rs
src/libstd/path.rs
src/libstd/process.rs
src/libstd/sys/unix/ext.rs
src/libstd/sys/unix/os.rs
src/libstd/sys/windows/ext.rs
src/libstd/sys/windows/os.rs
src/libstd/thread/mod.rs

Simple merge
Simple merge
Simple merge
Simple merge
index 78e21bdd14ef98bb82141164eb78df599a0976d0,1910530c63a42a738f232bffdbbe158413e71a4c..c1c05da4ee4b56767c6be4ec81661e4ec8d4fcd9
@@@ -167,12 -169,11 +167,12 @@@ impl CString 
          }
      }
  
-     /// Create a C-compatible string from a byte vector without checking for
+     /// Creates a C-compatible string from a byte vector without checking for
      /// interior 0 bytes.
      ///
 -    /// This method is equivalent to `from_vec` except that no runtime assertion
 -    /// is made that `v` contains no 0 bytes.
 +    /// This method is equivalent to `new` except that no runtime assertion
 +    /// is made that `v` contains no 0 bytes, and it requires an actual
 +    /// byte vector, not anyhting that can be converted to one with Into.
      #[stable(feature = "rust1", since = "1.0.0")]
      pub unsafe fn from_vec_unchecked(mut v: Vec<u8>) -> CString {
          v.push(0);
@@@ -244,8 -245,20 +244,8 @@@ impl From<NulError> for io::Error 
      }
  }
  
 -#[stable(feature = "rust1", since = "1.0.0")]
 -#[allow(deprecated)]
 -impl From<NulError> for old_io::IoError {
 -    fn from(_: NulError) -> old_io::IoError {
 -        old_io::IoError {
 -            kind: old_io::IoErrorKind::InvalidInput,
 -            desc: "data provided contains a nul byte",
 -            detail: None
 -        }
 -    }
 -}
 -
  impl CStr {
-     /// Cast a raw C string to a safe C string wrapper.
+     /// Casts a raw C string to a safe C string wrapper.
      ///
      /// This function will cast the provided `ptr` to the `CStr` wrapper which
      /// allows inspection and interoperation of non-owned C strings. This method
Simple merge
Simple merge
Simple merge
index a8608378e3fd3d5d4dd013db70290bb4f605d592,8d4af4689af293b42da223ea2132bf9c6cef2271..0e493b271f98f6da93e84d74b597ea8d68b512f1
@@@ -129,30 -127,7 +129,30 @@@ impl Ipv4Addr 
          self.octets()[0] >= 224 && self.octets()[0] <= 239
      }
  
-     /// Convert this address to an IPv4-compatible IPv6 address
 +    /// Returns true if this is a broadcast address.
 +    ///
 +    /// A broadcast address has all octets set to 255 as defined in RFC 919
 +    pub fn is_broadcast(&self) -> bool {
 +        self.octets()[0] == 255 && self.octets()[1] == 255 &&
 +        self.octets()[2] == 255 && self.octets()[3] == 255
 +    }
 +
 +    /// Returns true if this address is in a range designated for documentation
 +    ///
 +    /// This is defined in RFC 5737
 +    /// - 192.0.2.0/24 (TEST-NET-1)
 +    /// - 198.51.100.0/24 (TEST-NET-2)
 +    /// - 203.0.113.0/24 (TEST-NET-3)
 +    pub fn is_documentation(&self) -> bool {
 +        match(self.octets()[0], self.octets()[1], self.octets()[2], self.octets()[3]) {
 +            (192, _, 2, _) => true,
 +            (198, 51, 100, _) => true,
 +            (203, _, 113, _) => true,
 +            _ => false
 +        }
 +    }
 +
+     /// Converts this address to an IPv4-compatible IPv6 address
      ///
      /// a.b.c.d becomes ::a.b.c.d
      #[stable(feature = "rust1", since = "1.0.0")]
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge