executorch_sys/
c_bridge.rs

1mod c_link {
2    #![allow(unused)]
3    #![allow(unused_imports)]
4    #![allow(clippy::upper_case_acronyms)]
5    #![allow(clippy::missing_safety_doc)]
6    #![allow(rustdoc::invalid_html_tags)]
7    #![allow(rustdoc::broken_intra_doc_links)]
8    #![allow(missing_docs)]
9    #![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
10
11    include!(concat!(env!("OUT_DIR"), "/executorch_bindings.rs"));
12}
13pub use c_link::*;
14
15impl Copy for Error {}
16impl Copy for ScalarType {}
17impl Copy for Tag {}
18impl Copy for TensorShapeDynamism {}
19impl Copy for ProgramHeaderStatus {}
20impl Copy for ProgramVerification {}
21impl Copy for MmapDataLoaderMlockConfig {}
22impl Copy for ModuleLoadMode {}
23
24macro_rules! impl_ref_clone_copy {
25    ($name:ty) => {
26        impl Clone for $name {
27            fn clone(&self) -> Self {
28                *self
29            }
30        }
31        impl Copy for $name {}
32    };
33}
34
35// Ref and RefMut
36impl_ref_clone_copy!(EValueRef);
37impl_ref_clone_copy!(EValueRefMut);
38impl_ref_clone_copy!(TensorRef);
39impl_ref_clone_copy!(TensorRefMut);
40impl_ref_clone_copy!(OptionalTensorRef);
41impl_ref_clone_copy!(OptionalTensorRefMut);
42impl_ref_clone_copy!(DataLoaderRefMut);
43impl_ref_clone_copy!(EventTracerRefMut);
44
45// ArrayRef
46impl_ref_clone_copy!(ArrayRefBool);
47impl_ref_clone_copy!(ArrayRefChar);
48impl_ref_clone_copy!(ArrayRefDimOrderType);
49impl_ref_clone_copy!(ArrayRefEValue);
50impl_ref_clone_copy!(ArrayRefEValuePtr);
51impl_ref_clone_copy!(ArrayRefF64);
52impl_ref_clone_copy!(ArrayRefI32);
53impl_ref_clone_copy!(ArrayRefI64);
54impl_ref_clone_copy!(ArrayRefOptionalTensor);
55impl_ref_clone_copy!(ArrayRefSizesType);
56impl_ref_clone_copy!(ArrayRefStridesType);
57impl_ref_clone_copy!(ArrayRefTensor);
58impl_ref_clone_copy!(ArrayRefU8);
59impl_ref_clone_copy!(ArrayRefUsizeType);
60
61// Span
62impl_ref_clone_copy!(SpanI64);
63impl_ref_clone_copy!(SpanOptionalTensor);
64impl_ref_clone_copy!(SpanSpanU8);
65impl_ref_clone_copy!(SpanTensor);
66impl_ref_clone_copy!(SpanU8);