[−][src]Macro core_foundation::declare_TCFType
Declare a Rust type that wraps an underlying CoreFoundation type.
This will provide an implementation of Drop
using CFRelease
.
The type must have an implementation of the TCFType
trait, usually
provided using the impl_TCFType
macro.
#[macro_use] extern crate core_foundation; // Make sure that the `TCFType` trait is in scope. use core_foundation::base::{CFTypeID, TCFType}; extern "C" { // We need a function that returns the `CFTypeID`. pub fn ShrubberyGetTypeID() -> CFTypeID; } pub struct __Shrubbery {} // The ref type must be a pointer to the underlying struct. pub type ShrubberyRef = *const __Shrubbery; declare_TCFType!(Shrubbery, ShrubberyRef); impl_TCFType!(Shrubbery, ShrubberyRef, ShrubberyGetTypeID);