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

  • Rust Quick Start Guide
  • Daniel Arbuckle
  • 169字
  • 2021-06-10 19:46:00

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.

主站蜘蛛池模板: 璧山县| 吉水县| 山西省| 澎湖县| 民权县| 龙井市| 四平市| 安图县| 慈利县| 徐汇区| 平江县| 进贤县| 临泽县| 宁陵县| 江永县| 平南县| 阿克苏市| 汽车| 南陵县| 江阴市| 湟中县| 青州市| 万载县| 苍梧县| 芦山县| 泽普县| 平山县| 南江县| 孟村| 福泉市| 克东县| 武强县| 西青区| 隆林| 峨山| 锡林郭勒盟| 温宿县| 通城县| 洛扎县| 平定县| 永新县|