Debian Codegraph @

third_party/rust/core-foundation/tests/use_macro_outside_crate.rs

raw
1 use core_foundation::base::{CFComparisonResult, TCFType};
2 use core_foundation::{declare_TCFType, impl_CFComparison, impl_CFTypeDescription, impl_TCFType};
3 use std::os::raw::c_void;
4
5 // sys equivalent stuff that must be declared
6
7 #[repr(C)]
8 pub struct __CFFooBar(c_void);
9
10 pub type CFFooBarRef = *const __CFFooBar;
11
12 extern "C" {
13 pub fn CFFooBarGetTypeID() -> core_foundation::base::CFTypeID;
14 pub fn fake_compare(
15 this: CFFooBarRef,
16 other: CFFooBarRef,
17 context: *mut c_void,
18 ) -> CFComparisonResult;
19 }
20
21 // Try to use the macros outside of the crate
22
23 declare_TCFType!(CFFooBar, CFFooBarRef);
24 impl_TCFType!(CFFooBar, CFFooBarRef, CFFooBarGetTypeID);
25 impl_CFTypeDescription!(CFFooBar);
26 impl_CFComparison!(CFFooBar, fake_compare);