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

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -