Is there a trait that provides a method-shaped version of reference reborrowing?
I'm (again) working with sqlx, where the Executor trait is implemented for three families of types:
&mut 't Transaction<…>,
&mut 'c Connection<…>, and
&Pool<…>.
I'm trying to create a generic struct that can wrap an Executor and provide an app-appropriate interface to it, but I'm also trying to use sqlx::query::Map to generalize access to the schema.
And therein lies my problem. Map::fetch_one and friends all take a parameter of type E (with the constraint E: Executor) by value. I have something that I know to be of type E (with the same constraint), but I don't want to give up ownership of the value in order to call fetch_one with it. I can also assert knowledge that E is a reference rather than a bare value, if need be.
How do I write something equivalent to the line
let result = R::submit(submission) // Map<…>
.fetch_one(self.executor)
.await?;
that does not give up ownership of self.executor, which will generalize across the implementations of Executor I'm interested in? self can be &Self or &mut Self as needed here.