diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2016-07-04 16:41:53 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2016-07-04 16:48:16 +0200 |
commit | b6ca1b9b3bdf6cba99e082426dec860f66c05073 (patch) | |
tree | 4cb6704b91bcb8e079dd29748bdcfbc10669c28c /components/util/debug_utils.rs | |
parent | e77efb93c15a22aadb950d152e905a7ab1d27db9 (diff) | |
download | servo-b6ca1b9b3bdf6cba99e082426dec860f66c05073.tar.gz servo-b6ca1b9b3bdf6cba99e082426dec860f66c05073.zip |
Remove util::debug_utils
Diffstat (limited to 'components/util/debug_utils.rs')
-rw-r--r-- | components/util/debug_utils.rs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/components/util/debug_utils.rs b/components/util/debug_utils.rs deleted file mode 100644 index 631c7dad4ca..00000000000 --- a/components/util/debug_utils.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::{self, Write}; -use std::mem; -use std::mem::size_of; -use std::slice; - -fn hexdump_slice(buf: &[u8]) { - let mut stderr = io::stderr(); - stderr.write_all(b" ").unwrap(); - for (i, &v) in buf.iter().enumerate() { - let output = format!("{:02X} ", v); - stderr.write_all(output.as_bytes()).unwrap(); - match i % 16 { - 15 => { stderr.write_all(b"\n ").unwrap(); }, - 7 => { stderr.write_all(b" ").unwrap(); }, - _ => () - } - stderr.flush().unwrap(); - } - stderr.write_all(b"\n").unwrap(); -} - -pub fn hexdump<T>(obj: &T) { - unsafe { - let buf: *const u8 = mem::transmute(obj); - debug!("dumping at {:p}", buf); - let from_buf = slice::from_raw_parts(buf, size_of::<T>()); - hexdump_slice(from_buf); - } -} |