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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
extern crate core;
pub use crate::_detail::{c2rust::*, xed_interface_inner::*};
#[deprecated(since = "0.3.0", note = "All exports are now in the crate root")]
pub mod xed_interface {
pub use crate::*;
}
#[deprecated(since = "0.3.0", note = "All exports are now in the crate root")]
pub mod xed_version {
pub use crate::{xed_get_copyright, xed_get_version};
}
mod _detail {
mod libc {
pub(crate) use std::os::raw::*;
}
pub(crate) mod c2rust {
#![allow(
clippy::all,
dead_code,
non_camel_case_types,
unused_variables,
unused_assignments,
unused_mut
)]
use super::libc;
use super::xed_interface_inner::*;
type uint8_t = u8;
type uint16_t = u16;
type uint32_t = u32;
type uint64_t = u64;
type int8_t = i8;
type int16_t = i16;
type int32_t = i32;
type int64_t = i64;
type C2RustUnnamed_6 = xed_encoder_operand_t__bindgen_ty_1;
include!("xed-c2rust.rs");
}
pub(crate) mod xed_interface_inner {
#![allow(
clippy::all,
non_camel_case_types,
non_snake_case,
non_upper_case_globals,
intra_doc_link_resolution_failure
)]
include!(concat!(env!("OUT_DIR"), "/xed_interface.rs"));
}
#[cfg(test)]
mod tests {
use crate::*;
#[test]
fn test_xed_get_copyright() {
let copyright = unsafe {
std::ffi::CStr::from_ptr(xed_get_copyright())
.to_string_lossy()
.to_string()
};
assert_eq!(
"Copyright (C) 2019, Intel Corporation. All rights reserved.",
©right
);
}
#[test]
fn test_xed_version() {
use std::ffi::CStr;
let version_cstr = unsafe { CStr::from_ptr(xed_get_version()) };
let version = version_cstr.to_string_lossy();
let git_version = CStr::from_bytes_with_nul(XED_GIT_VERSION)
.unwrap()
.to_string_lossy();
assert_eq!(version, git_version);
}
}
}