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
mod options;
mod tree;
pub use options::*;
pub use tree::*;
use core::ptr::null_mut;
use std::ffi::{c_void, CString};
use super::NcTreeItem;
impl NcTreeItem {
pub fn new(curry: &str, subs: Option<&mut [NcTreeItem]>, subcount: usize) -> Self {
if let Some(subs) = subs {
Self {
curry: CString::new(curry).unwrap().into_raw() as *mut _ as *mut c_void,
subs: subs.as_mut_ptr(),
subcount: subcount as u32,
}
} else {
Self {
curry: CString::new(curry).unwrap().into_raw() as *mut _ as *mut c_void,
subs: null_mut(),
subcount: subcount as u32,
}
}
}
}