pub struct Ref<'a, T: 'a> {
borrow_count: &'a Cell<isize>,
value: &'a T,
}
AFAICT these two references always point to adjacent data:
struct RefManagerInnerData<T> {
borrow_count: Cell<isize>,
value: T,
}
Is there any reason to not prefer:
pub struct Ref<'a, T: 'a> {
inner: &'a RefManagerInnerData<T>,
}
One issue I see is the mutable case:
#[derive(Debug)]
pub struct RefMut<'a, T: 'a> {
borrow_count: &'a Cell<isize>,
value: &'a mut T,
}
Because here one of the references is immutable and the other is mutable. However AFAICT we could just use a pointer instead, and present the same safe interface.
AFAICT these two references always point to adjacent data:
Is there any reason to not prefer:
One issue I see is the mutable case:
Because here one of the references is immutable and the other is mutable. However AFAICT we could just use a pointer instead, and present the same safe interface.