With a class which needs to be shared:
struct A;
impl A {
fn new() -> Self { A }
fn a(&self) {}
fn b(&mut self) {}
}
struct AShared(Rc<RefCell<A>>);
is there a way to generate functions which call their inside equivalents? That is, generate some/all of the following:
impl AShared {
fn new() -> Self { Self(Rc::new(RefCell::new(A::new()))) }
fn a(&self) { self.0.borrow().a() }
fn b(&mut self) { self.0.borrow_mut().b() }
}