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

  • 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.

主站蜘蛛池模板: 桂平市| 遵义市| 亳州市| 长兴县| 龙泉市| 淮北市| 翁牛特旗| 辛集市| 当雄县| 株洲县| 西贡区| 淮滨县| 潜山县| 垫江县| 怀远县| 仙桃市| 拜城县| 广德县| 汾西县| 西林县| 台中县| 双桥区| 互助| 垣曲县| 聊城市| 塘沽区| 兰西县| 柳州市| 祁东县| 太康县| 庐江县| 呼和浩特市| 含山县| 汤阴县| 喜德县| 新丰县| 偃师市| 高碑店市| 仙居县| 正定县| 平塘县|