We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is something the standard library does, for example for String: https://doc.rust-lang.org/src/alloc/string.rs.html#2645
Basically, the derive would just wrap a Clone call. This allows functions taking Into<T> to also take &T.
Clone
Into<T>
&T
impl From<&mut Self> for Something { fn from(this: &mut Self) -> Self { this.clone() } } impl From<&Self> for Something { fn from(this: &Self) -> Self { this.clone() } }
The text was updated successfully, but these errors were encountered:
I'd like to see this rather as derive(From) customization with attributes, rather than separate macros.
derive(From)
Sorry, something went wrong.
No branches or pull requests
This is something the standard library does, for example for String: https://doc.rust-lang.org/src/alloc/string.rs.html#2645
Basically, the derive would just wrap a
Clone
call. This allows functions takingInto<T>
to also take&T
.The text was updated successfully, but these errors were encountered: