- Learning Rust
- Paul Johnson Vesa Kaihlavirta
- 172字
- 2021-07-02 23:07:13
Using Cargo to build and run an application
As we are all able to create directory structures, Cargo is then able to build and execute our source code.
If you look at the source code that comes with this chapter, you will find a directory called app_name. To build this package using Cargo, type the following from a Terminal (or command on Windows) window:
cd app_name cargo build app_name
This will build the source code; finally you will be informed that the compilation has been successful:

Next, we can use Cargo to execute the binary as follows:
cargo run
If everything has worked, you will see something like the following:

As with any sort of utility, it's possible to "daisy-chain" the build and execution into one line, as follows:
cargo build; cargo run
You may be wondering why the first operation performed was to move into the application structure rather than just type cargo build. This is because Cargo is looking for the Cargo.toml file (remember, this acts as a build script).
- Implementing Modern DevOps
- Boost C++ Application Development Cookbook(Second Edition)
- MATLAB圖像處理超級(jí)學(xué)習(xí)手冊(cè)
- Mastering Articulate Storyline
- 精通Scrapy網(wǎng)絡(luò)爬蟲
- 你必須知道的204個(gè)Visual C++開發(fā)問(wèn)題
- Mastering AndEngine Game Development
- 人人都懂設(shè)計(jì)模式:從生活中領(lǐng)悟設(shè)計(jì)模式(Python實(shí)現(xiàn))
- Python:Master the Art of Design Patterns
- Scala編程實(shí)戰(zhàn)(原書第2版)
- Python入門很輕松(微課超值版)
- 創(chuàng)意UI Photoshop玩轉(zhuǎn)移動(dòng)UI設(shè)計(jì)
- NGUI for Unity
- Arduino機(jī)器人系統(tǒng)設(shè)計(jì)及開發(fā)
- AMP:Building Accelerated Mobile Pages