Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

Fix example to compile #182

Merged
merged 3 commits into from
Apr 4, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 20 additions & 19 deletions src/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,26 +330,27 @@ impl<'a, T: ?Sized + FromBase64> FromBase64 for &'a T {
}

/// Base64 decoding lookup table, generated using:
/// ```rust
/// let mut ch = 0u8;
/// loop {
/// let code = match ch {
/// b'A'...b'Z' => ch - 0x41,
/// b'a'...b'z' => ch - 0x47,
/// b'0'...b'9' => ch + 0x04,
/// b'+' | b'-' => 0x3E,
/// b'/' | b'_' => 0x3F,
/// b'=' => 0xFE,
/// b'\r' | b'\n' => 0xFD,
/// _ => 0xFF,
/// };
/// print!("0x{:02X}, ", code);
/// if ch % 16 == 15 { println!(""); }
/// else if ch == 0xFF { break; }
/// ch += 1;
/// }
/// println!("");
///
/// ```
/// let mut ch = 0u8;
/// for ch in 0..255 {
/// let mut ch = ch as u8;
/// let code = match ch {
/// b'A'...b'Z' => ch - 0x41,
/// b'a'...b'z' => ch - 0x47,
/// b'0'...b'9' => ch + 0x04,
/// b'+' | b'-' => 0x3E,
/// b'/' | b'_' => 0x3F,
/// b'=' => 0xFE,
/// b'\r' | b'\n' => 0xFD,
/// _ => 0xFF,
/// };
/// print!("0x{:02X}, ", code);
/// if ch % 16 == 15 { println!(""); }
/// else if ch == 0xFF { break; }
/// ch += 1;
/// }
/// println!("");
/// ```
const DECODE_TABLE: [u8; 256] = [
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF,
Expand Down