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

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.

主站蜘蛛池模板: 阿巴嘎旗| 晋江市| 阜城县| 红桥区| 罗定市| 高雄市| 嵊州市| 天全县| 长治县| 石柱| 新和县| 扎囊县| 石门县| 邵东县| 武鸣县| 宁蒗| 麻阳| 漯河市| 建昌县| 江油市| 县级市| 翁源县| 涟水县| 陈巴尔虎旗| 武陟县| 刚察县| 罗江县| 怀安县| 滨州市| 晋州市| 康马县| 新闻| 洛阳市| 乌鲁木齐县| 宿州市| 富源县| 望都县| 莱州市| 宜良县| 丰台区| 黄石市|