Rust Programming Tutorial #26 - Command Line Arguments

preview_player
Показать описание
Today you're gonna see how we can grab command line arguments from a Rust program. In Rust, the first command line argument can be found at index 0.

Documentation to refer to regarding this video:

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
Рекомендации по теме
Комментарии
Автор

Love these videos; thanks for making them!

I'm just learning Rust, but doesn't env::args() return an Iterator? If so, then presumably you could just do

for arg in env::args() { ... }

without making a Vec out of the args first?

ClearerThanMud
Автор

What's a good cli arguments parser that can generate the help text, like python's argparse?

charliegnu
Автор

Is there a clean way to check that args[1] exists to protect println! from panic with 'index out of bounds' (that doesn't involve wrapping it in an if statement)?

recklessroges