A function that takes a borrowed pointer &T can also be called with an owning pointer ~T, an RC pointer Rc<T>, or a GC pointer Gc<T>. They all convert neatly to a &T. One function to rule them ... err .. accomodate all.
No. That would be nice to have, but it's actually not the case. The only type that automatically coerces to a borrowed reference is an owned pointer. For value references you fist have to create a borrowes ref through &val. For Gc and Rc you have to pass something like ptr.borrow().borrow_mut ().borrow()

Reply via email to