Last active
May 18, 2022 15:14
-
-
Save kriogenia/09909cc3691de8cce5de8b91933d189d to your computer and use it in GitHub Desktop.
Generify with compiler errors - No bounds function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn sum<T>(numbers: &[T]) -> T { | |
let mut total = numbers[0]; | |
for i in numbers.into_iter().skip(1) { | |
total = total + *i; | |
} | |
total | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment