The enumerate iterator adapter gives you an iterator over (index, element) rather than an iterator of element.
In this case you would want to change the match to
match c {
(index, '1') => num += 2.pow(index),
(_, '0') => {},
_ => println!("Invalid input!")
}
That should work because you're matching on the tuple (you could also do the tuple deconstruction while iterating over the elements)
You don't need to collect into the reversed string though since that's allocating a new string when you can just iterate over
input.chars().rev().enumerate()
Directly