How to wrap a borrowed value in a newtype that is also a borrowed value?
问题 I am trying to use the newtype pattern to wrap a pre-existing type. That inner type has a modify method which lets us work with a borrowed mutable value in a callback: struct Val; struct Inner(Val); impl Inner { fn modify<F>(&self, f: F) where F: FnOnce(&mut Val) -> &mut Val { … } } Now I want to provide a very similar method on my newtype Outer , which however should not work on Val s but again a newtype wrapper WrappedVal : struct Outer(Inner); struct WrappedVal(Val); impl Outer { fn modify