Skip to content

Instantly share code, notes, and snippets.

@kriogenia
Last active May 18, 2022 15:14
Show Gist options
  • Save kriogenia/09909cc3691de8cce5de8b91933d189d to your computer and use it in GitHub Desktop.
Save kriogenia/09909cc3691de8cce5de8b91933d189d to your computer and use it in GitHub Desktop.
Generify with compiler errors - No bounds function
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