How to skip the first item(s) of an iterator in Rust? -
when iterating on arguments (for example) thats straightforward way skip first n elements?
eg:
use std::env; fn main() { arg in env::args() { println!("argument: {}", arg); } }
i tried env::args()[1..]
slicing isn't supported.
whats simplest way skip first arguments of iterator?
turns out .skip()
method can used, eg:
use std::env; fn main() { arg in env::args().skip(1) { println!("argument: {}", arg); } }
Comments
Post a Comment