-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
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
Implement trait Into<T>
in lib-std
#3399
Labels
Comments
mohammadfawaz
changed the title
Implement Generic Into in the std
Implement Nov 23, 2022
trait Into<T>
in lib-std
This requires generic traits which we already have. It also requires trait constraints on // From implies Into
impl<T, U> Into<U> for T
where
U: From<T>,
{
/// Calls `U::from(self)`.
///
/// That is, this conversion is whatever the implementation of
/// `From<T>` for `U` chooses to do.
fn into(self) -> U {
U::from(self)
}
} where pub trait Into<T>: Sized {
/// Converts this type into the (usually inferred) input type.
fn into(self) -> T;
} |
4 tasks
@mohammadfawaz in light of #3637 , this issue could probably be simplified not to require any trait constraints, as we're moving towards decoupling |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sway should have an
Into
trait in the Standard library forAlso From implementation should automatically derive
Into
The text was updated successfully, but these errors were encountered: