use crate::sync::Arc;
use alloc::rc::Rc;
use core::ops::Deref;
pub trait RefCounter: Clone + Deref<Target = Self::Item> {
type Item;
fn new(elem: Self::Item) -> Self;
}
impl<T> RefCounter for Arc<T> {
type Item = T;
#[inline]
fn new(elem: Self::Item) -> Self {
Arc::new(elem)
}
}
impl<T> RefCounter for Rc<T> {
type Item = T;
#[inline]
fn new(elem: Self::Item) -> Self {
Rc::new(elem)
}
}