Use a smaller crate for hex stuff

It's really overkill to pull in rustc_serialize just for hex conversions
This commit is contained in:
Steven Fackler 2015-12-06 14:27:03 -08:00
parent cc4441f958
commit 0e6b03d06b
7 changed files with 13 additions and 9 deletions

View File

@ -28,8 +28,9 @@ bufstream = "0.1"
byteorder = ">= 0.3, < 0.5"
log = "0.3"
phf = "0.7"
rustc-serialize = "0.3"
hex = "0.1"
net2 = { version = "0.2", features = ["nightly"] }
rustc-serialize = { version = "0.3", optional = true }
chrono = { version = "0.2.14", optional = true }
openssl = { version = ">= 0.6.4, < 0.8", optional = true }
serde = { version = "0.3", optional = true } # Delete for 0.11

View File

@ -46,10 +46,10 @@
extern crate bufstream;
extern crate byteorder;
extern crate hex;
#[macro_use]
extern crate log;
extern crate phf;
extern crate rustc_serialize as serialize;
#[cfg(feature = "unix_socket")]
extern crate unix_socket;
extern crate net2;

View File

@ -477,11 +477,11 @@ impl Md5 {
}
pub fn result_str(&mut self) -> String {
use serialize::hex::ToHex;
use hex::ToHex;
let mut buf: Vec<u8> = repeat(0).take((self.output_bits() + 7) / 8).collect();
self.result(&mut buf);
buf[..].to_hex()
buf.to_hex()
}
}

View File

@ -1,4 +1,6 @@
use serialize::json;
extern crate rustc_serialize;
use self::rustc_serialize::json;
use std::error;
use std::io::prelude::*;
use byteorder::{ReadBytesExt, WriteBytesExt};

View File

@ -10,7 +10,7 @@
use std::io::prelude::*;
use std::str::FromStr;
use std::str;
use serialize::hex::FromHex;
use hex::FromHex;
pub struct Url {
pub scheme: String,
@ -133,7 +133,7 @@ fn decode_inner(c: &str, full_url: bool) -> DecodeResult<String> {
};
// Only decode some characters if full_url:
match str::from_utf8(&bytes).unwrap().from_hex().unwrap()[0] as char {
match Vec::<u8>::from_hex(str::from_utf8(&bytes).unwrap()).unwrap()[0] as char {
// gen-delims:
':' |
'/' |

View File

@ -1,5 +1,4 @@
extern crate postgres;
extern crate rustc_serialize as serialize;
extern crate url;
#[cfg(feature = "openssl")]
extern crate openssl;

View File

@ -1,4 +1,6 @@
use serialize::json::Json;
extern crate rustc_serialize;
use self::rustc_serialize::json::Json;
use types::test_type;