pointer-identity 0.1.1

Wrapper type to treat the pointer address of types as identity rather than the value
Documentation
use super::Pointer;
use std::{rc::Rc, sync::Arc};

impl<T: ?Sized> Pointer for Arc<T> {
    type Target = T;

    fn get(&self) -> *const Self::Target {
        Arc::as_ptr(self)
    }
}

impl<T: ?Sized> Pointer for Rc<T> {
    type Target = T;

    fn get(&self) -> *const Self::Target {
        Rc::as_ptr(self)
    }
}

impl<T: ?Sized> Pointer for Box<T> {
    type Target = T;

    fn get(&self) -> *const Self::Target {
        &**self as *const Self::Target
    }
}

impl<T> Pointer for Vec<T> {
    type Target = T;

    fn get(&self) -> *const Self::Target {
        self.as_ptr()
    }
}

impl<T> Pointer for &[T] {
    type Target = T;

    fn get(&self) -> *const Self::Target {
        self.as_ptr()
    }
}

impl<const LEN: usize, T> Pointer for &[T; LEN] {
    type Target = T;

    fn get(&self) -> *const Self::Target {
        self.as_ptr()
    }
}