use vapoursynth_sys as ffi;
use api::API;
#[derive(Debug)]
pub struct Function {
handle: *mut ffi::VSFuncRef,
}
unsafe impl Send for Function {}
unsafe impl Sync for Function {}
impl Drop for Function {
#[inline]
fn drop(&mut self) {
unsafe {
API::get_cached().free_func(self.handle);
}
}
}
impl Clone for Function {
#[inline]
fn clone(&self) -> Self {
let handle = unsafe { API::get_cached().clone_func(self.handle) };
Self { handle }
}
}
impl Function {
#[inline]
pub(crate) unsafe fn from_ptr(handle: *mut ffi::VSFuncRef) -> Self {
Self { handle }
}
#[inline]
pub(crate) fn ptr(&self) -> *mut ffi::VSFuncRef {
self.handle
}
}