lib.rs 1.28 KB
Newer Older
qinsoon's avatar
qinsoon committed
1
extern crate byteorder;
2
extern crate rustc_serialize;
qinsoon's avatar
qinsoon committed
3

4
pub type BitSize    = usize;
5 6 7
pub type ByteOffset = isize;
pub type ByteSize   = usize;
pub type Word       = usize;
qinsoon's avatar
qinsoon committed
8 9 10 11 12 13 14 15 16

#[cfg(target_arch = "x86_64")]
pub const LOG_POINTER_SIZE : usize = 3;

pub const POINTER_SIZE     : ByteSize = 1 << LOG_POINTER_SIZE;
pub const WORD_SIZE        : ByteSize = 1 << LOG_POINTER_SIZE;

pub mod mem;

17
mod linked_hashmap;
qinsoon's avatar
qinsoon committed
18
mod linked_hashset;
19
pub use linked_hashmap::LinkedHashMap;
qinsoon's avatar
qinsoon committed
20
pub use linked_hashset::LinkedHashSet;
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

#[macro_export]
macro_rules! linked_hashmap {
    (@single $($x:tt)*) => (());
    (@count $($rest:expr),*) => (<[()]>::len(&[$(linked_hashmap!(@single $rest)),*]));

    ($($key:expr => $value:expr,)+) => { linked_hashmap!($($key => $value),+) };
    ($($key:expr => $value:expr),*) => {
        {
            let _cap = linked_hashmap!(@count $($key),*);
            let mut _map = LinkedHashMap::with_capacity(_cap);
            $(
                _map.insert($key, $value);
            )*
            _map
        }
    };
}
qinsoon's avatar
qinsoon committed
39 40 41 42 43 44 45 46 47 48 49

mod address;
pub use address::Address;
pub use address::ObjectReference;

// This porvides some missing operations on Vec.
// They are not included in the standard libarary.
// (because they are likely inefficient?)
pub mod vec_utils;

pub mod bit_utils;
50
pub mod string_utils;