Skip to content

Commit

Permalink
move rustdoc comments so that they attach to the functions rather tha…
Browse files Browse the repository at this point in the history
…n the impl blocks.
  • Loading branch information
astrieanna committed Apr 13, 2013
1 parent 27a0269 commit 8e64b61
Showing 1 changed file with 79 additions and 79 deletions.
158 changes: 79 additions & 79 deletions src/libstd/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ static CHARS: [char, ..64] = [
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'
];

/**
* Turn a vector of `u8` bytes into a string representing them in base64.
*
* *Example*:
*
* ~~~~
* extern mod std;
* use std::base64::ToBase64;
*
* fn main () {
* let str = [52,32].to_base64();
* println(fmt!("%s", str));
* }
* ~~~~
*/
impl<'self> ToBase64 for &'self [u8] {
/**
* Turn a vector of `u8` bytes into a string representing them in base64.
*
* *Example*:
*
* ~~~~
* extern mod std;
* use std::base64::ToBase64;
*
* fn main () {
* let str = [52,32].to_base64();
* println(fmt!("%s", str));
* }
* ~~~~
*/
fn to_base64(&self) -> ~str {
let mut s = ~"";
unsafe {
Expand Down Expand Up @@ -90,24 +90,24 @@ impl<'self> ToBase64 for &'self [u8] {
}
}

/**
* Convert any string (literal, `@`, `&`, `~`) to base64 encoding.
*
*
* *Example*:
*
* ~~~~
* extern mod std;
* use std::base64::ToBase64;
*
* fn main () {
* let str = "Hello, World".to_base64();
* println(fmt!("%s",str));
* }
* ~~~~
*
*/
impl<'self> ToBase64 for &'self str {
/**
* Convert any string (literal, `@`, `&`, `~`) to base64 encoding.
*
*
* *Example*:
*
* ~~~~
* extern mod std;
* use std::base64::ToBase64;
*
* fn main () {
* let str = "Hello, World".to_base64();
* println(fmt!("%s",str));
* }
* ~~~~
*
*/
fn to_base64(&self) -> ~str {
str::to_bytes(*self).to_base64()
}
Expand All @@ -117,26 +117,26 @@ pub trait FromBase64 {
fn from_base64(&self) -> ~[u8];
}

/**
* Turn a vector of `u8`s representing characters
* encoding byte values in base64 into the vector of `u8` byte values.
*
* *Example*:
*
* ~~~~
* extern mod std;
* use std::base64::ToBase64;
* use std::base64::FromBase64;
*
* fn main () {
* let str = [52,32].to_base64();
* println(fmt!("%s", str));
* let bytes = str.from_base64();
* println(fmt!("%?",bytes));
* }
* ~~~~
*/
impl FromBase64 for ~[u8] {
/**
* Turn a vector of `u8`s representing characters
* encoding byte values in base64 into the vector of `u8` byte values.
*
* *Example*:
*
* ~~~~
* extern mod std;
* use std::base64::ToBase64;
* use std::base64::FromBase64;
*
* fn main () {
* let str = [52,32].to_base64();
* println(fmt!("%s", str));
* let bytes = str.from_base64();
* println(fmt!("%?",bytes));
* }
* ~~~~
*/
fn from_base64(&self) -> ~[u8] {
if self.len() % 4u != 0u { fail!(~"invalid base64 length"); }

Expand Down Expand Up @@ -198,35 +198,35 @@ impl FromBase64 for ~[u8] {
}
}

/**
* Convert any string (literal, `@`, `&`, `~`)
* that contains a base64 encoded value, to the byte values it encodes.
*
* You can use the `from_bytes` function in `core::str`
* to turn a `[u8]` into a string with characters corresponding to those values.
*
* *Example*:
*
* This is an example of going from a string literal to the base64 encoding
* and back to the same string.
*
* ~~~~
* extern mod std;
* use std::base64::ToBase64;
* use std::base64::FromBase64;
* use core::str;
*
* fn main () {
* let hello_str = "Hello, World".to_base64();
* println(fmt!("%s",hello_str));
* let bytes = hello_str.from_base64();
* println(fmt!("%?",bytes));
* let result_str = str::from_bytes(bytes);
* println(fmt!("%s",result_str));
* }
* ~~~~
*/
impl FromBase64 for ~str {
/**
* Convert any string (literal, `@`, `&`, `~`)
* that contains a base64 encoded value, to the byte values it encodes.
*
* You can use the `from_bytes` function in `core::str`
* to turn a `[u8]` into a string with characters corresponding to those values.
*
* *Example*:
*
* This is an example of going from a string literal to the base64 encoding
* and back to the same string.
*
* ~~~~
* extern mod std;
* use std::base64::ToBase64;
* use std::base64::FromBase64;
* use core::str;
*
* fn main () {
* let hello_str = "Hello, World".to_base64();
* println(fmt!("%s",hello_str));
* let bytes = hello_str.from_base64();
* println(fmt!("%?",bytes));
* let result_str = str::from_bytes(bytes);
* println(fmt!("%s",result_str));
* }
* ~~~~
*/
fn from_base64(&self) -> ~[u8] {
str::to_bytes(*self).from_base64()
}
Expand Down

0 comments on commit 8e64b61

Please sign in to comment.