executorch_sys/cxx_bridge/
core.rs1#![allow(clippy::missing_safety_doc)]
3
4use cxx::{type_id, ExternType};
5
6#[cxx::bridge]
7pub(crate) mod ffi {
8
9 unsafe extern "C++" {
10 include!("executorch-sys/cpp/executorch_rs/cxx_bridge.hpp");
11
12 type MemoryAllocator = crate::MemoryAllocator;
14
15 #[namespace = "executorch_rs"]
20 fn BufferMemoryAllocator_into_memory_allocator_unique_ptr(
21 self_: Pin<&mut MemoryAllocator>,
22 ) -> UniquePtr<MemoryAllocator>;
23
24 #[namespace = "executorch::extension"]
30 type MallocMemoryAllocator;
31
32 #[namespace = "executorch_rs"]
34 fn MallocMemoryAllocator_new() -> UniquePtr<MallocMemoryAllocator>;
35
36 #[namespace = "executorch_rs"]
40 unsafe fn MallocMemoryAllocator_as_memory_allocator(
41 self_: Pin<&mut MallocMemoryAllocator>,
42 ) -> *mut MemoryAllocator;
43
44 #[namespace = "executorch_rs"]
46 fn MallocMemoryAllocator_into_memory_allocator_unique_ptr(
47 self_: UniquePtr<MallocMemoryAllocator>,
48 ) -> UniquePtr<MemoryAllocator>;
49
50 }
51
52 impl UniquePtr<MemoryAllocator> {}
53}
54
55unsafe impl ExternType for crate::ScalarType {
56 type Id = type_id!("ScalarType");
57 type Kind = cxx::kind::Trivial;
58}
59
60unsafe impl ExternType for crate::TensorShapeDynamism {
61 type Id = type_id!("TensorShapeDynamism");
62 type Kind = cxx::kind::Trivial;
63}
64
65unsafe impl ExternType for crate::Error {
66 type Id = type_id!("Error");
67 type Kind = cxx::kind::Trivial;
68}
69
70unsafe impl ExternType for crate::MethodMeta {
71 type Id = type_id!("MethodMeta");
72 type Kind = cxx::kind::Trivial;
73}
74
75unsafe impl ExternType for crate::ArrayRefEValue {
76 type Id = type_id!("ArrayRefEValue");
77 type Kind = cxx::kind::Trivial;
78}
79
80unsafe impl ExternType for crate::VecEValue {
81 type Id = type_id!("VecEValue");
82 type Kind = cxx::kind::Trivial;
83}
84
85unsafe impl ExternType for crate::ProgramVerification {
86 type Id = type_id!("ProgramVerification");
87 type Kind = cxx::kind::Trivial;
88}
89
90unsafe impl ExternType for crate::MemoryAllocator {
91 type Id = type_id!("MemoryAllocator");
92 type Kind = cxx::kind::Opaque;
93}