官术网_书友最值得收藏!

Starting a new project

Okay, so we've installed the compiler. Yay! But how do we use it?

The first step is to open up a command-line window, and navigate to the directory where we want to store our new project. Then we can create the skeleton of a new program with cargo new foo.

When we do this, cargo will create a new directory named foo and set up the skeletal program inside it.

The default is for cargo to create the skeleton of an executable program, but we can also tell it to set up a new library for us. All that takes is an additional command-line argument (bar is the name of the new directory that will be created, like foo): cargo new --lib bar.

When we look inside the newly created foo directory, we see a file called Cargo.toml and a sub-directory called src. There may also be a Git version control repository, which we will ignore for now.

主站蜘蛛池模板: 东明县| 二连浩特市| 霍州市| 商南县| 武定县| 汉源县| 麻栗坡县| 佛学| 盐池县| 日土县| 丹凤县| 青河县| 乌兰县| 清河县| 金塔县| 老河口市| 滨海县| 游戏| 虎林市| 澳门| 巴林右旗| 崇礼县| 察雅县| 珠海市| 梨树县| 桃园市| 子洲县| 泾川县| 叶城县| 临安市| 澄迈县| 宜春市| 潞西市| 渭源县| 凌海市| 新密市| 中山市| 九龙坡区| 台东市| 鹤岗市| 繁昌县|