tesseract_swift_utils/
data.rs

1use super::array::{CArray, CArrayRef};
2use super::error::CError;
3use super::panic::PanicContext;
4use crate::response::CMoveResponse;
5use super::traits::TryAsRef;
6use std::mem::ManuallyDrop;
7
8pub type CDataRef<'a> = CArrayRef<'a, u8>;
9pub type CData = CArray<u8>;
10
11#[no_mangle]
12pub unsafe extern "C" fn tesseract_utils_data_clone(
13    data: CDataRef,
14    res: &mut ManuallyDrop<CData>,
15    err: &mut ManuallyDrop<CError>,
16) -> bool {
17    CError::panic_context(|| data.try_as_ref()).response(res, err)
18}
19
20#[no_mangle]
21pub unsafe extern "C" fn tesseract_utils_data_free(data: &mut ManuallyDrop<CData>) {
22    ManuallyDrop::drop(data);
23}