Skip to content

Instantly share code, notes, and snippets.

@MrGibus
Created September 13, 2020 14:55
Show Gist options
  • Select an option

  • Save MrGibus/055e1973fc1a8102e71729ad6b9eed52 to your computer and use it in GitHub Desktop.

Select an option

Save MrGibus/055e1973fc1a8102e71729ad6b9eed52 to your computer and use it in GitHub Desktop.
For printing vectors
fn printv<T>(vector: &[T])
where T: std::fmt::Display
{
for i in vector.iter() {
println!("{} ", i)
}
}
fn printvi<T>(vector: &[T])
where T: std::fmt::Display
{
for (i, n) in vector.iter().enumerate() {
println!("{}: {} ", i, n)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment