How do I run a project's example using Cargo?

前端 未结 2 1587
眼角桃花
眼角桃花 2021-01-05 05:48

I\'m trying to run the example code from this project. Following the instructions on the Cargo docs, I did the following:

         


        
2条回答
  •  耶瑟儿~
    2021-01-05 06:00

    You can run a specific example with:

    cargo run --example name_of_example
    

    where name_of_example is the base filename (without .rs)

    or to run it in release mode:

    cargo run --release --example name_of_example
    

    To pass arguments to the example:

    cargo run --example name_of_example -- arguments go here
    

    cargo run will automatically build (or rebuild) the program first if it's out of date.

提交回复
热议问题