forked from ijl/orjson
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyyjson.rs
More file actions
94 lines (94 loc) · 2.38 KB
/
Copy pathyyjson.rs
File metadata and controls
94 lines (94 loc) · 2.38 KB
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
pub type __uint32_t = ::std::os::raw::c_uint;
pub type __int64_t = ::std::os::raw::c_long;
pub type __uint64_t = ::std::os::raw::c_ulong;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct yyjson_alc {
pub malloc: ::std::option::Option<
unsafe extern "C" fn(
ctx: *mut ::std::os::raw::c_void,
size: usize,
) -> *mut ::std::os::raw::c_void,
>,
pub realloc: ::std::option::Option<
unsafe extern "C" fn(
ctx: *mut ::std::os::raw::c_void,
ptr: *mut ::std::os::raw::c_void,
size: usize,
) -> *mut ::std::os::raw::c_void,
>,
pub free: ::std::option::Option<
unsafe extern "C" fn(ctx: *mut ::std::os::raw::c_void, ptr: *mut ::std::os::raw::c_void),
>,
pub ctx: *mut ::std::os::raw::c_void,
}
extern "C" {
pub fn yyjson_alc_pool_init(
alc: *mut yyjson_alc,
buf: *mut ::std::os::raw::c_void,
size: usize,
) -> bool;
}
pub type yyjson_read_flag = u32;
pub const YYJSON_READ_NOFLAG: yyjson_read_flag = 0;
pub type yyjson_read_code = u32;
pub const YYJSON_READ_SUCCESS: yyjson_read_code = 0;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct yyjson_read_err {
pub code: yyjson_read_code,
pub msg: *const ::std::os::raw::c_char,
pub pos: usize,
}
extern "C" {
pub fn yyjson_read_opts(
dat: *mut ::std::os::raw::c_char,
len: usize,
flg: yyjson_read_flag,
alc: *const yyjson_alc,
err: *mut yyjson_read_err,
) -> *mut yyjson_doc;
}
extern "C" {
pub fn yyjson_doc_free(doc: *mut yyjson_doc);
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union yyjson_val_uni {
pub u64_: u64,
pub i64_: i64,
pub f64_: f64,
pub str_: *const ::std::os::raw::c_char,
pub ptr: *mut ::std::os::raw::c_void,
pub ofs: usize,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct yyjson_val {
pub tag: u64,
pub uni: yyjson_val_uni,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct yyjson_doc {
pub root: *mut yyjson_val,
pub alc: yyjson_alc,
pub dat_read: usize,
pub val_read: usize,
pub str_pool: *mut ::std::os::raw::c_char,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct yyjson_arr_iter {
pub idx: usize,
pub max: usize,
pub cur: *mut yyjson_val,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct yyjson_obj_iter {
pub idx: usize,
pub max: usize,
pub cur: *mut yyjson_val,
pub obj: *mut yyjson_val,
}