Expand description
Command line arguments by reference: Iterator<Item = &'static OsStr>
The standard library’s std::env::args_os
iterator produces an owned
string (OsString
) for each argument. In some use cases it can be more
convenient for the arguments to be produced by static reference (&'static OsStr
).
Examples
fn main() {
for arg in argv::iter() {
// arg is a &'static OsStr.
println!("{}", arg.to_string_lossy());
}
}
Portability
This crate is intended to be used on Linux and macOS, on which command line arguments naturally live for the duration of the program. This crate implements the same API on other platforms as well, such as Windows, but leaks memory on platforms other than Linux and macOS.
Structs
- Iterator over command line arguments.
Functions
- Returns an iterator over command line arguments.