Skip to content

Commit

Permalink
Move base64 and hex from libextra to libserialize
Browse files Browse the repository at this point in the history
  • Loading branch information
liigo committed Feb 12, 2014
1 parent 0ac6e5a commit a102aef
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
2 changes: 0 additions & 2 deletions src/libextra/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ pub mod url;
pub mod json;
pub mod tempfile;
pub mod time;
pub mod base64;
pub mod workcache;
pub mod enum_set;
pub mod stats;
pub mod hex;

#[cfg(unicode)]
mod unicode;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use std::run;
use std::str;
use std::io;
use std::io::fs;
use extra::hex::ToHex;
use serialize::hex::ToHex;
use extra::tempfile::TempDir;
use syntax::abi;
use syntax::ast;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/util/sha2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::iter::range_step;
use std::num::Zero;
use std::vec;
use std::vec::bytes::{MutableByteVector, copy_memory};
use extra::hex::ToHex;
use serialize::hex::ToHex;

/// Write a u32 into a vector, which must be 4 bytes long. The value is written in big-endian
/// format.
Expand Down Expand Up @@ -529,7 +529,7 @@ mod tests {
use std::vec;
use std::rand::isaac::IsaacRng;
use std::rand::Rng;
use extra::hex::FromHex;
use serialize::hex::FromHex;

// A normal addition - no overflow occurs
#[test]
Expand Down
12 changes: 6 additions & 6 deletions src/libextra/base64.rs → src/libserialize/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ impl<'a> ToBase64 for &'a [u8] {
* # Example
*
* ```rust
* extern mod extra;
* use extra::base64::{ToBase64, STANDARD};
* extern mod serialize;
* use serialize::base64::{ToBase64, STANDARD};
*
* fn main () {
* let str = [52,32].to_base64(STANDARD);
Expand Down Expand Up @@ -189,8 +189,8 @@ impl<'a> FromBase64 for &'a str {
* This converts a string literal to base64 and back.
*
* ```rust
* extern mod extra;
* use extra::base64::{ToBase64, FromBase64, STANDARD};
* extern mod serialize;
* use serialize::base64::{ToBase64, FromBase64, STANDARD};
* use std::str;
*
* fn main () {
Expand Down Expand Up @@ -261,8 +261,8 @@ impl<'a> FromBase64 for &'a str {

#[cfg(test)]
mod test {
use test::BenchHarness;
use base64::*;
use extra::test::BenchHarness;
use base64::{Config, FromBase64, ToBase64, STANDARD, URL_SAFE};

#[test]
fn test_to_base64_basic() {
Expand Down
10 changes: 6 additions & 4 deletions src/libextra/hex.rs → src/libserialize/hex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ impl<'a> ToHex for &'a [u8] {
* # Example
*
* ```rust
* use extra::hex::ToHex;
* extern mod serialize;
* use serialize::hex::ToHex;
*
* fn main () {
* let str = [52,32].to_hex();
Expand Down Expand Up @@ -88,7 +89,8 @@ impl<'a> FromHex for &'a str {
* This converts a string literal to hexadecimal and back.
*
* ```rust
* use extra::hex::{FromHex, ToHex};
* extern mod serialize;
* use serialize::hex::{FromHex, ToHex};
* use std::str;
*
* fn main () {
Expand Down Expand Up @@ -137,8 +139,8 @@ impl<'a> FromHex for &'a str {

#[cfg(test)]
mod tests {
use test::BenchHarness;
use hex::*;
use extra::test::BenchHarness;
use hex::{FromHex, ToHex};

#[test]
pub fn test_to_hex() {
Expand Down
4 changes: 4 additions & 0 deletions src/libserialize/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ pub use self::serialize::{Decoder, Encoder, Decodable, Encodable,
DecoderHelpers, EncoderHelpers};

mod serialize;

pub mod base64;
pub mod ebml;
pub mod hex;

3 comments on commit a102aef

@alexcrichton
Copy link

Choose a reason for hiding this comment

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

r+, thanks!

@alexcrichton
Copy link

Choose a reason for hiding this comment

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

@bors: retry

@alexcrichton
Copy link

Choose a reason for hiding this comment

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

@bors: retry

Please sign in to comment.