use libc::c_void;
use crate::sys::ffi;
pub(super) unsafe fn with_autorelease<T, F: FnOnce() -> T>(call: F) -> T {
struct DrainPool {
ctx: *mut c_void,
}
impl Drop for DrainPool {
fn drop(&mut self) {
unsafe { ffi::objc_autoreleasePoolPop(self.ctx) }
}
}
let _pool_ctx = DrainPool {
ctx: unsafe { ffi::objc_autoreleasePoolPush() },
};
call()
}