2023-08-17 23:14:32 +00:00
|
|
|
use super::*;
|
|
|
|
// Section: wire functions
|
|
|
|
|
|
|
|
#[no_mangle]
|
2023-08-19 00:12:44 +00:00
|
|
|
pub extern "C" fn wire_get_tx_config(port_: i64, bytes: *mut wire_uint_8_list) {
|
|
|
|
wire_get_tx_config_impl(port_, bytes)
|
2023-08-17 23:14:32 +00:00
|
|
|
}
|
|
|
|
|
2023-08-19 00:12:44 +00:00
|
|
|
// Section: allocate functions
|
|
|
|
|
2023-08-17 23:14:32 +00:00
|
|
|
#[no_mangle]
|
2023-08-19 00:12:44 +00:00
|
|
|
pub extern "C" fn new_uint_8_list_0(len: i32) -> *mut wire_uint_8_list {
|
|
|
|
let ans = wire_uint_8_list {
|
|
|
|
ptr: support::new_leak_vec_ptr(Default::default(), len),
|
|
|
|
len,
|
|
|
|
};
|
|
|
|
support::new_leak_box_ptr(ans)
|
2023-08-17 23:14:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Section: related functions
|
|
|
|
|
|
|
|
// Section: impl Wire2Api
|
|
|
|
|
2023-08-19 00:12:44 +00:00
|
|
|
impl Wire2Api<Vec<u8>> for *mut wire_uint_8_list {
|
|
|
|
fn wire2api(self) -> Vec<u8> {
|
|
|
|
unsafe {
|
|
|
|
let wrap = support::box_from_leak_ptr(self);
|
|
|
|
support::vec_from_leak_ptr(wrap.ptr, wrap.len)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-08-17 23:14:32 +00:00
|
|
|
// Section: wire structs
|
|
|
|
|
2023-08-19 00:12:44 +00:00
|
|
|
#[repr(C)]
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct wire_uint_8_list {
|
|
|
|
ptr: *mut u8,
|
|
|
|
len: i32,
|
|
|
|
}
|
|
|
|
|
2023-08-17 23:14:32 +00:00
|
|
|
// Section: impl NewWithNullPtr
|
|
|
|
|
|
|
|
pub trait NewWithNullPtr {
|
|
|
|
fn new_with_null_ptr() -> Self;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<T> NewWithNullPtr for *mut T {
|
|
|
|
fn new_with_null_ptr() -> Self {
|
|
|
|
std::ptr::null_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Section: sync execution mode utility
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
pub extern "C" fn free_WireSyncReturn(ptr: support::WireSyncReturn) {
|
|
|
|
unsafe {
|
|
|
|
let _ = support::box_from_leak_ptr(ptr);
|
|
|
|
};
|
|
|
|
}
|