diff options
author | Jack Moffitt <jack@metajack.im> | 2014-06-01 00:21:53 -0600 |
---|---|---|
committer | Jack Moffitt <jack@metajack.im> | 2014-06-05 09:58:59 -0600 |
commit | 629c4c6afe7cea86c051bb9f52adeac716e2c43f (patch) | |
tree | ee84d9a9b37ecd37e0a9606509624e7f728f5a81 /src/components/util/debug.rs | |
parent | 2ae671b5aa9d27812adcdb8ebc749733156df66e (diff) | |
download | servo-629c4c6afe7cea86c051bb9f52adeac716e2c43f.tar.gz servo-629c4c6afe7cea86c051bb9f52adeac716e2c43f.zip |
Upgrade Rust.
Diffstat (limited to 'src/components/util/debug.rs')
-rw-r--r-- | src/components/util/debug.rs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/components/util/debug.rs b/src/components/util/debug.rs deleted file mode 100644 index 6bd32517138..00000000000 --- a/src/components/util/debug.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -use std::io; -use std::io::Writer; -use std::cast::transmute; -use std::mem::size_of; -use std::slice::raw::buf_as_slice; - -fn hexdump_slice(buf: &[u8]) { - let mut stderr = io::stderr(); - stderr.write(bytes!(" ")).unwrap(); - for (i, &v) in buf.iter().enumerate() { - let output = format!("{:02X} ", v as uint); - stderr.write(output.as_bytes()).unwrap(); - match i % 16 { - 15 => { stderr.write(bytes!("\n ")).unwrap(); }, - 7 => { stderr.write(bytes!(" ")).unwrap(); }, - _ => () - } - stderr.flush().unwrap(); - } - stderr.write(bytes!("\n")).unwrap(); -} - -pub fn hexdump<T>(obj: &T) { - unsafe { - let buf: *u8 = transmute(obj); - debug!("dumping at {:p}", buf); - buf_as_slice(buf, size_of::<T>(), hexdump_slice); - } -} |