1pub use bindings::{
25 uci_add_delta_path, uci_add_list, uci_add_section, uci_alloc_context, uci_backend, uci_command,
26 uci_commit, uci_context, uci_del_list, uci_delete, uci_delta, uci_element, uci_export,
27 uci_flags, uci_free_context, uci_get_errorstr, uci_hash_options, uci_import, uci_list,
28 uci_list_configs, uci_load, uci_lookup_next, uci_lookup_ptr, uci_option, uci_option_type,
29 uci_option_type_UCI_TYPE_STRING, uci_package, uci_parse_argument, uci_parse_context,
30 uci_parse_option, uci_parse_ptr, uci_parse_section, uci_perror, uci_ptr,
31 uci_ptr_UCI_LOOKUP_COMPLETE, uci_rename, uci_reorder_section, uci_revert, uci_save,
32 uci_section, uci_set, uci_set_backend, uci_set_confdir, uci_set_savedir, uci_type,
33 uci_type_UCI_TYPE_OPTION, uci_type_UCI_TYPE_SECTION, uci_unload, uci_validate_text, UCI_OK,
34};
35
36#[allow(non_upper_case_globals)]
37#[allow(non_camel_case_types)]
38#[allow(non_snake_case)]
39#[allow(dead_code)]
40mod bindings {
41 use std::ffi::CStr;
42
43 include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
44
45 impl core::fmt::Debug for uci_option {
46 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
47 f.debug_struct("uci_option")
48 .field("e", &self.e)
49 .field("section", unsafe { &self.section.as_ref() })
50 .field("type", &self.type_)
51 .finish()
52 }
53 }
54
55 impl core::fmt::Debug for uci_ptr {
56 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
57 let package = unsafe { self.package.as_ref().map(|r| CStr::from_ptr(r)) };
58 let section = unsafe { self.section.as_ref().map(|r| CStr::from_ptr(r)) };
59 let option = unsafe { self.option.as_ref().map(|r| CStr::from_ptr(r)) };
60 let value = unsafe { self.value.as_ref().map(|r| CStr::from_ptr(r)) };
61 f.debug_struct("uci_ptr")
62 .field("target", &self.target)
63 .field("flags", &self.flags)
64 .field("p", unsafe { &self.p.as_ref() })
65 .field("s", unsafe { &self.s.as_ref() })
66 .field("o", unsafe { &self.o.as_ref() })
67 .field("last", unsafe { &self.last.as_ref() })
68 .field("package", &package.map(|v| v.to_str()))
69 .field("section", §ion.map(|v| v.to_str()))
70 .field("option", &option.map(|v| v.to_str()))
71 .field("value", &value.map(|v| v.to_str()))
72 .finish()
73 }
74 }
75}