Ways to improve my crate?

I created a crate called borrow_trait, which provides 2 traits for immutably and mutably borrowing from different kinds of RefCells and wrappers like Arc<RefCell>.
I am not sure if there is anything I can improve or add :confused:

struct AcceptsBound<'a, C, T>
where
    T: BorrowRef<'a, Target = C>,
    C: Read
{
    value: T,
    _c: PhantomData<&'a C>,
}
let value = AcceptsBound {
   value: Cursor::new(vec![]),
   _c: PhantomData
}

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=365b380e31cd362e2a3d32eeea72680b

1 Like

Instead of implementing for &T and &mut T directly, you can use blanket impls that forward to T, like this,

impl<'a, 'b: 'a, T: 'a + BorrowRef<'a>> BorrowRef<'a> for &'b T {
    ...
}
1 Like

Arc<RefCell<T>> is not Send as RefCell<T> is not Send, so it's not more useful than Rc<RefCell<T>>. But it still increment/decrement its counter with atomic operation which comes with its cost, while guaranteed to be single thread access.