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::extension"]
21 type MallocMemoryAllocator;
22
23 #[namespace = "executorch_rs"]
25 fn MallocMemoryAllocator_new() -> UniquePtr<MallocMemoryAllocator>;
26
27 #[namespace = "executorch_rs"]
31 unsafe fn MallocMemoryAllocator_as_memory_allocator(
32 self_: Pin<&mut MallocMemoryAllocator>,
33 ) -> *mut MemoryAllocator;
34 }
35}
36
37unsafe impl ExternType for crate::ScalarType {
38 type Id = type_id!("ScalarType");
39 type Kind = cxx::kind::Trivial;
40}
41
42unsafe impl ExternType for crate::TensorShapeDynamism {
43 type Id = type_id!("TensorShapeDynamism");
44 type Kind = cxx::kind::Trivial;
45}
46
47unsafe impl ExternType for crate::Error {
48 type Id = type_id!("Error");
49 type Kind = cxx::kind::Trivial;
50}
51
52unsafe impl ExternType for crate::MethodMeta {
53 type Id = type_id!("MethodMeta");
54 type Kind = cxx::kind::Trivial;
55}
56
57unsafe impl ExternType for crate::ArrayRefEValue {
58 type Id = type_id!("ArrayRefEValue");
59 type Kind = cxx::kind::Trivial;
60}
61
62unsafe impl ExternType for crate::VecEValue {
63 type Id = type_id!("VecEValue");
64 type Kind = cxx::kind::Trivial;
65}
66
67unsafe impl ExternType for crate::ProgramVerification {
68 type Id = type_id!("ProgramVerification");
69 type Kind = cxx::kind::Trivial;
70}
71
72unsafe impl ExternType for crate::MemoryAllocator {
73 type Id = type_id!("MemoryAllocator");
74 type Kind = cxx::kind::Trivial;
75}