dex/
lib.rs

1//! Dex is a library for reading Android's
2//! [dex](https://source.android.com/devices/tech/dalvik/dex-format) file format.
3// Silence warnings in error module for now
4#![allow(bare_trait_objects)]
5
6pub extern crate scroll;
7
8#[macro_use]
9extern crate scroll_derive;
10
11#[macro_use]
12extern crate bitflags;
13
14#[macro_use]
15extern crate log;
16
17extern crate getset;
18
19pub use error::Error;
20
21pub use crate::dex::{Dex, DexReader, Header};
22
23#[macro_use]
24mod utils;
25pub mod annotation;
26mod cache;
27pub mod class;
28pub mod code;
29mod dex;
30mod encoded_item;
31pub mod encoded_value;
32mod error;
33pub mod field;
34pub mod jtype;
35pub mod method;
36mod search;
37mod source;
38pub mod string;
39
40/// The constant NO_INDEX is used to indicate that an index value is absent.
41pub const NO_INDEX: uint = 0xffff_ffff;
42const ENDIAN_CONSTANT: (ubyte, ubyte, ubyte, ubyte) = (0x12, 0x34, 0x56, 0x78);
43const REVERSE_ENDIAN_CONSTANT: (ubyte, ubyte, ubyte, ubyte) = (0x78, 0x56, 0x34, 0x12);
44
45/// 8-bit signed int
46#[allow(non_camel_case_types)]
47pub type byte = i8;
48/// 32-bit unsigned int
49#[allow(non_camel_case_types)]
50pub type uint = u32;
51/// 32-bit signed int
52#[allow(non_camel_case_types)]
53pub type int = i32;
54/// 16-bit unsigned int
55#[allow(non_camel_case_types)]
56pub type ushort = u16;
57/// 16-bit signed int
58#[allow(non_camel_case_types)]
59pub type short = i16;
60/// 8-bit unsigned int
61#[allow(non_camel_case_types)]
62pub type ubyte = u8;
63/// 64-bit unsigned int
64#[allow(non_camel_case_types)]
65pub type ulong = u64;
66/// 64-bit signed int
67#[allow(non_camel_case_types)]
68pub type long = i64;
69
70/// A `Result` of `T` or an error of `error::Error`
71pub type Result<T> = std::result::Result<T, error::Error>;
72
73// ref. https://source.android.com/devices/tech/dalvik/dex-format
74
75/// The endianness of bytes.
76pub type Endian = scroll::Endian;