xabc_lib/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
pub mod abc;
pub mod bytecode;
pub mod class;
pub mod code;
mod error;
pub mod field;
pub mod header;
pub mod literal;
pub mod lnp;
pub mod method;
pub mod region;
pub mod source;
pub mod string;

use scroll::{Sleb128, Uleb128};

/// 8-bit 无符号整数
#[allow(non_camel_case_types)]
pub type uint8_t = u8;
/// 16-bit无符号整数,采用小端字节序。
#[allow(non_camel_case_types)]
pub type uint16_t = u16;
/// 32-bit无符号整数,采用小端字节序。
#[allow(non_camel_case_types)]
pub type uint32_t = u32;
/// leb128编码的无符号整数
#[allow(non_camel_case_types)]
pub type uleb128_t = Uleb128;
/// leb128编码的有符号整数。
#[allow(non_camel_case_types)]
pub type sleb128_t = Sleb128;

// A `Result` of `T` or an error of `error::Error`
//pub type Result<T> = std::result::Result<T, error::Error>;

#[cfg(feature = "logging")]
fn init_logging() {
    // 测试运行的时候,不需要设置 RUST_LOG=debug
    tracing_subscriber::fmt()
        .with_max_level(tracing::Level::DEBUG)
        .init();
}

#[cfg(not(feature = "logging"))]
fn init_logging() {}