fast-canny 0.1.0

Industrial-grade Zero-Allocation SIMD Canny Edge Detector
Documentation
/// 跨线程可变裸指针包装器。
pub struct SendPtr<T> {
    ptr: *mut T,
}
unsafe impl<T> Send for SendPtr<T> {}
unsafe impl<T> Sync for SendPtr<T> {}
impl<T> Copy for SendPtr<T> {}
impl<T> Clone for SendPtr<T> {
    fn clone(&self) -> Self {
        *self
    }
}
impl<T> SendPtr<T> {
    pub fn new(ptr: *mut T) -> Self {
        Self { ptr }
    }
    pub unsafe fn get(self) -> *mut T {
        self.ptr
    }
}

/// 跨线程只读裸指针包装器。
pub struct SendConstPtr<T> {
    ptr: *const T,
}
unsafe impl<T> Send for SendConstPtr<T> {}
unsafe impl<T> Sync for SendConstPtr<T> {}
impl<T> Copy for SendConstPtr<T> {}
impl<T> Clone for SendConstPtr<T> {
    fn clone(&self) -> Self {
        *self
    }
}
impl<T> SendConstPtr<T> {
    pub fn new(ptr: *const T) -> Self {
        Self { ptr }
    }
    pub unsafe fn get(self) -> *const T {
        self.ptr
    }
}