I was surprised that this has always worked:
struct User(usize);
struct UserProtoBuf(usize);
impl<'a> From<&'a User> for UserProtoBuf {
fn from<'b>(user: &'b User) -> Self {
UserProtoBuf(user.0)
}
}
I would have expected that it needed to be
impl<'a> From<&'a User> for UserProtoBuf {
fn from(user: &'a User) -> Self {
UserProtoBuf(user.0)
}
}
So that the from method matched the expected type exactly.
But I guess since it’s unconstrained it’s fine?
It’s interesting that, with IHLE, this means you can just write the following and it works:
impl From<&User> for UserProtoBuf {
fn from(user: &User) -> Self {
UserProtoBuf(user.0)
}
}
So maybe it’s good even if it feels weird to me?