We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Some food for thought:
fn f(args: ..i32) { // args has an anonymous type which implements Iterator<Item=i32> for arg in args { println!("{}", arg); } } fn g(args: ..&Any) { // args implements Iterator<Item=&Any> for (i, arg) in args.enumerate() { if arg.is::<&str> { println!("{}: &str: {}", i, arg.downcast_ref::<&str>().unwrap()); } else if arg.is::<&i32> { println!("{}: i32: {}", i, arg.downcast_ref::<i32>().unwrap()); } } } fn main() { f(1, 2, 3, 4); // 1 // 2 // 3 // 4 g(&"hello", &"world", &1, &2); // 0: &str: hello // 1: &str: world // 2: i32: 1 // 3: i32: 2 // Splice syntax let vec = vec!(1, 2, 3, 4); f(..vec.into_iter()); // 1 // 2 // 3 // 4 }
The text was updated successfully, but these errors were encountered:
(See also #376.)
Sorry, something went wrong.
See also #2137.
Closing since I think #2137 covers this.
No branches or pull requests
Some food for thought:
The text was updated successfully, but these errors were encountered: