1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use super::Pointer;
use std::{rc::Rc, sync::Arc};

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

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

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

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

impl<T> 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()
    }
}