Skip to content

Commit

Permalink
Correct code examples for base64 documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal committed Oct 9, 2013
1 parent e505d4c commit 0b4f052
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/libextra/base64.rs
Expand Up @@ -64,11 +64,11 @@ impl<'self> ToBase64 for &'self [u8] {
*
* ```rust
* extern mod extra;
* use extra::base64::{ToBase64, standard};
* use extra::base64::{ToBase64, STANDARD};
*
* fn main () {
* let str = [52,32].to_base64(standard);
* println!("{}", str);
* let str = [52,32].to_base64(STANDARD);
* println!("base 64 output: {}", str);
* }
* ```
*/
Expand Down Expand Up @@ -172,16 +172,19 @@ impl<'self> FromBase64 for &'self str {
*
* ```rust
* extern mod extra;
* use extra::base64::{ToBase64, FromBase64, standard};
* use extra::base64::{ToBase64, FromBase64, STANDARD};
* use std::str;
*
* fn main () {
* let hello_str = "Hello, World".to_base64(standard);
* println!("{}", hello_str);
* let bytes = hello_str.from_base64();
* println!("{:?}", bytes);
* let result_str = str::from_utf8(bytes);
* println!("{}", result_str);
* let hello_str = bytes!("Hello, World").to_base64(STANDARD);
* println!("base64 output: {}", hello_str);
* let res = hello_str.from_base64();
* if res.is_ok() {
* let optBytes = str::from_utf8_opt(res.unwrap());
* if optBytes.is_some() {
* println!("decoded from base64: {}", optBytes.unwrap());
* }
* }
* }
* ```
*/
Expand Down

5 comments on commit 0b4f052

@bors
Copy link
Contributor

@bors bors commented on 0b4f052 Oct 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at Geal@0b4f052

@bors
Copy link
Contributor

@bors bors commented on 0b4f052 Oct 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging Geal/rust/base64-doc = 0b4f052 into auto

@bors
Copy link
Contributor

@bors bors commented on 0b4f052 Oct 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Geal/rust/base64-doc = 0b4f052 merged ok, testing candidate = 62812f1

@bors
Copy link
Contributor

@bors bors commented on 0b4f052 Oct 9, 2013

@bors
Copy link
Contributor

@bors bors commented on 0b4f052 Oct 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 62812f1

Please sign in to comment.