executorch_sys/cxx_bridge/
core.rs1#![allow(clippy::missing_safety_doc)]
3#![allow(non_camel_case_types)]
5
6use cxx::{ExternType, type_id};
7
8#[cxx::bridge]
9pub(crate) mod ffi {
10
11 unsafe extern "C++" {
12 include!("executorch-sys/cpp/executorch_rs/cxx_bridge.hpp");
13
14 type ET_MemoryAllocator = crate::ET_MemoryAllocator;
16
17 #[namespace = "executorch_rs"]
22 fn BufferMemoryAllocator_into_memory_allocator_unique_ptr(
23 self_: Pin<&mut ET_MemoryAllocator>,
24 ) -> UniquePtr<ET_MemoryAllocator>;
25
26 #[namespace = "executorch::extension"]
32 type MallocMemoryAllocator;
33
34 #[namespace = "executorch_rs"]
36 fn MallocMemoryAllocator_new() -> UniquePtr<MallocMemoryAllocator>;
37
38 #[namespace = "executorch_rs"]
42 unsafe fn MallocMemoryAllocator_as_memory_allocator(
43 self_: Pin<&mut MallocMemoryAllocator>,
44 ) -> *mut ET_MemoryAllocator;
45
46 #[namespace = "executorch_rs"]
48 fn MallocMemoryAllocator_into_memory_allocator_unique_ptr(
49 self_: UniquePtr<MallocMemoryAllocator>,
50 ) -> UniquePtr<ET_MemoryAllocator>;
51
52 }
53
54 impl UniquePtr<ET_MemoryAllocator> {}
55}
56
57unsafe impl ExternType for crate::ET_ScalarType {
58 type Id = type_id!("ET_ScalarType");
59 type Kind = cxx::kind::Trivial;
60}
61
62unsafe impl ExternType for crate::ET_TensorShapeDynamism {
63 type Id = type_id!("ET_TensorShapeDynamism");
64 type Kind = cxx::kind::Trivial;
65}
66
67unsafe impl ExternType for crate::ET_Error {
68 type Id = type_id!("ET_Error");
69 type Kind = cxx::kind::Trivial;
70}
71
72unsafe impl ExternType for crate::ET_MethodMeta {
73 type Id = type_id!("ET_MethodMeta");
74 type Kind = cxx::kind::Trivial;
75}
76
77unsafe impl ExternType for crate::ET_ArrayRefEValue {
78 type Id = type_id!("ET_ArrayRefEValue");
79 type Kind = cxx::kind::Trivial;
80}
81
82unsafe impl ExternType for crate::ET_VecEValue {
83 type Id = type_id!("ET_VecEValue");
84 type Kind = cxx::kind::Trivial;
85}
86
87unsafe impl ExternType for crate::ET_ProgramVerification {
88 type Id = type_id!("ET_ProgramVerification");
89 type Kind = cxx::kind::Trivial;
90}
91
92unsafe impl ExternType for crate::ET_MemoryAllocator {
93 type Id = type_id!("ET_MemoryAllocator");
94 type Kind = cxx::kind::Opaque;
95}
96
97unsafe impl ExternType for crate::ET_Device {
98 type Id = type_id!("ET_Device");
99 type Kind = cxx::kind::Trivial;
100}