summary refs log tree commit diff
path: root/src/libserialize
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2014-11-24 20:06:06 -0500
committerSteve Klabnik <steve@steveklabnik.com>2014-11-25 21:24:16 -0500
commitf38e4e6d97bf1691858d007afd36b1f356de4774 (patch)
tree8b7da6e5965cfdd680908d294bb6814b14b36298 /src/libserialize
parent689ef2dabfa3b2b379c953e5fb68ce2c805c2231 (diff)
downloadrust-f38e4e6d97bf1691858d007afd36b1f356de4774.tar.gz
rust-f38e4e6d97bf1691858d007afd36b1f356de4774.zip
/** -> ///
This is considered good convention.
Diffstat (limited to 'src/libserialize')
-rw-r--r--src/libserialize/base64.rs82
-rw-r--r--src/libserialize/hex.rs76
2 files changed, 75 insertions, 83 deletions
diff --git a/src/libserialize/base64.rs b/src/libserialize/base64.rs
index 41feee8257f..b7d8885a5f9 100644
--- a/src/libserialize/base64.rs
+++ b/src/libserialize/base64.rs
@@ -64,21 +64,19 @@ pub trait ToBase64 for Sized? {
 }
 
 impl ToBase64 for [u8] {
-    /**
-     * Turn a vector of `u8` bytes into a base64 string.
-     *
-     * # Example
-     *
-     * ```rust
-     * extern crate serialize;
-     * use serialize::base64::{ToBase64, STANDARD};
-     *
-     * fn main () {
-     *     let str = [52,32].to_base64(STANDARD);
-     *     println!("base 64 output: {}", str);
-     * }
-     * ```
-     */
+    /// Turn a vector of `u8` bytes into a base64 string.
+    ///
+    /// # Example
+    ///
+    /// ```rust
+    /// extern crate serialize;
+    /// use serialize::base64::{ToBase64, STANDARD};
+    ///
+    /// fn main () {
+    ///     let str = [52,32].to_base64(STANDARD);
+    ///     println!("base 64 output: {}", str);
+    /// }
+    /// ```
     fn to_base64(&self, config: Config) -> String {
         let bytes = match config.char_set {
             Standard => STANDARD_CHARS,
@@ -194,34 +192,32 @@ impl error::Error for FromBase64Error {
 }
 
 impl FromBase64 for str {
-    /**
-     * Convert any base64 encoded string (literal, `@`, `&`, or `~`)
-     * to the byte values it encodes.
-     *
-     * You can use the `String::from_utf8` function to turn a `Vec<u8>` into a
-     * string with characters corresponding to those values.
-     *
-     * # Example
-     *
-     * This converts a string literal to base64 and back.
-     *
-     * ```rust
-     * extern crate serialize;
-     * use serialize::base64::{ToBase64, FromBase64, STANDARD};
-     *
-     * fn main () {
-     *     let hello_str = b"Hello, World".to_base64(STANDARD);
-     *     println!("base64 output: {}", hello_str);
-     *     let res = hello_str.as_slice().from_base64();
-     *     if res.is_ok() {
-     *       let opt_bytes = String::from_utf8(res.unwrap());
-     *       if opt_bytes.is_ok() {
-     *         println!("decoded from base64: {}", opt_bytes.unwrap());
-     *       }
-     *     }
-     * }
-     * ```
-     */
+    /// Convert any base64 encoded string (literal, `@`, `&`, or `~`)
+    /// to the byte values it encodes.
+    ///
+    /// You can use the `String::from_utf8` function to turn a `Vec<u8>` into a
+    /// string with characters corresponding to those values.
+    ///
+    /// # Example
+    ///
+    /// This converts a string literal to base64 and back.
+    ///
+    /// ```rust
+    /// extern crate serialize;
+    /// use serialize::base64::{ToBase64, FromBase64, STANDARD};
+    ///
+    /// fn main () {
+    ///     let hello_str = b"Hello, World".to_base64(STANDARD);
+    ///     println!("base64 output: {}", hello_str);
+    ///     let res = hello_str.as_slice().from_base64();
+    ///     if res.is_ok() {
+    ///       let opt_bytes = String::from_utf8(res.unwrap());
+    ///       if opt_bytes.is_ok() {
+    ///         println!("decoded from base64: {}", opt_bytes.unwrap());
+    ///       }
+    ///     }
+    /// }
+    /// ```
     #[inline]
     fn from_base64(&self) -> Result<Vec<u8>, FromBase64Error> {
         self.as_bytes().from_base64()
diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs
index 78859d6778d..2a3c410ba7c 100644
--- a/src/libserialize/hex.rs
+++ b/src/libserialize/hex.rs
@@ -27,21 +27,19 @@ pub trait ToHex for Sized? {
 static CHARS: &'static[u8] = b"0123456789abcdef";
 
 impl ToHex for [u8] {
-    /**
-     * Turn a vector of `u8` bytes into a hexadecimal string.
-     *
-     * # Example
-     *
-     * ```rust
-     * extern crate serialize;
-     * use serialize::hex::ToHex;
-     *
-     * fn main () {
-     *     let str = [52,32].to_hex();
-     *     println!("{}", str);
-     * }
-     * ```
-     */
+    /// Turn a vector of `u8` bytes into a hexadecimal string.
+    ///
+    /// # Example
+    ///
+    /// ```rust
+    /// extern crate serialize;
+    /// use serialize::hex::ToHex;
+    ///
+    /// fn main () {
+    ///     let str = [52,32].to_hex();
+    ///     println!("{}", str);
+    /// }
+    /// ```
     fn to_hex(&self) -> String {
         let mut v = Vec::with_capacity(self.len() * 2);
         for &byte in self.iter() {
@@ -95,31 +93,29 @@ impl error::Error for FromHexError {
 
 
 impl FromHex for str {
-    /**
-     * Convert any hexadecimal encoded string (literal, `@`, `&`, or `~`)
-     * to the byte values it encodes.
-     *
-     * You can use the `String::from_utf8` function to turn a
-     * `Vec<u8>` into a string with characters corresponding to those values.
-     *
-     * # Example
-     *
-     * This converts a string literal to hexadecimal and back.
-     *
-     * ```rust
-     * extern crate serialize;
-     * use serialize::hex::{FromHex, ToHex};
-     *
-     * fn main () {
-     *     let hello_str = "Hello, World".as_bytes().to_hex();
-     *     println!("{}", hello_str);
-     *     let bytes = hello_str.as_slice().from_hex().unwrap();
-     *     println!("{}", bytes);
-     *     let result_str = String::from_utf8(bytes).unwrap();
-     *     println!("{}", result_str);
-     * }
-     * ```
-     */
+    /// Convert any hexadecimal encoded string (literal, `@`, `&`, or `~`)
+    /// to the byte values it encodes.
+    ///
+    /// You can use the `String::from_utf8` function to turn a
+    /// `Vec<u8>` into a string with characters corresponding to those values.
+    ///
+    /// # Example
+    ///
+    /// This converts a string literal to hexadecimal and back.
+    ///
+    /// ```rust
+    /// extern crate serialize;
+    /// use serialize::hex::{FromHex, ToHex};
+    ///
+    /// fn main () {
+    ///     let hello_str = "Hello, World".as_bytes().to_hex();
+    ///     println!("{}", hello_str);
+    ///     let bytes = hello_str.as_slice().from_hex().unwrap();
+    ///     println!("{}", bytes);
+    ///     let result_str = String::from_utf8(bytes).unwrap();
+    ///     println!("{}", result_str);
+    /// }
+    /// ```
     fn from_hex(&self) -> Result<Vec<u8>, FromHexError> {
         // This may be an overestimate if there is any whitespace
         let mut b = Vec::with_capacity(self.len() / 2);