1use std::marker::PhantomData;
4use std::ops::Deref;
5use std::rc::Rc;
6use std::sync::Arc;
7
8pub trait PointerFamily<'a> {
13 type Pointer<T: 'a>: Deref<Target = T> + Clone;
15}
16
17pub struct ArcFamily;
19
20impl<'a> PointerFamily<'a> for ArcFamily {
21 type Pointer<T: 'a> = Arc<T>;
22}
23
24pub struct RcFamily;
26
27impl<'a> PointerFamily<'a> for RcFamily {
28 type Pointer<T: 'a> = Rc<T>;
29}
30
31pub struct RefFamily<'a>(PhantomData<&'a ()>);
33
34impl<'a> PointerFamily<'a> for RefFamily<'a> {
35 type Pointer<T: 'a> = &'a T;
36}