Cargo, Rust’s Package Manager
http://doc.crates.io/
Installing
The easiest way to get Cargo is to get the current stable release of Rust by using the rustup script:
$ curl -sSf https://static.rust-lang.org/rustup.sh | sh
This will get you the current stable release of Rust for your platform along with the latest Cargo.
If you are on Windows, you can directly download the latest 32bit (Rust and Cargo) or 64bit (Rust andCargo) Rust stable releases or Cargo nightlies.
Alternatively, you can build Cargo from source.
Let’s get started
To start a new project with Cargo, use cargo new:
$ cargo new hello_world --bin
We’re passing --bin because we’re making a binary program: if we were making a library, we’d leave it off.
Let’s check out what Cargo has generated for us:
$ cd hello_world
$ tree .
.
├── Cargo.toml
└── src
└── main.rs
1 directory, 2 files
This is all we need to get started. First, let’s check out Cargo.toml:
[package]
name = "hello_world"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
This is called a manifest, and it contains all of the metadata that Cargo needs to compile your project.
Here’s what’s in src/main.rs:
fn main() {
println!("Hello, world!");
}
Cargo generated a “hello world” for us. Let’s compile it:
$ cargo build
Compiling hello_world v0.1.0 (file:///path/to/project/hello_world)
And then run it:
$ ./target/debug/hello_world
Hello, world!
We can also use cargo run to compile and then run it, all in one step:
$ cargo run
Fresh hello_world v0.1.0 (file:///path/to/project/hello_world)
Running `target/hello_world`
Hello, world!
Going further
For more details on using Cargo, check out the Cargo Guide
Cargo, Rust’s Package Manager的更多相关文章
- 你需要知道的包管理器(Package Manager)
最近我花了一点时间关注了在不同系统之中所用到的包管理器(Package Manager) .最开始的时候,我是在使用Linux操作系统时,对这种工具以及它背后的想法深深迷恋住了:这真是自由的软件世界. ...
- 解决VS2015启动时Package manager console崩溃的问题 - Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope
安装VS2015,启动以后,Package manager console崩溃,错误信息如下: Windows PowerShell updated your execution policy suc ...
- Visual Studio 2015 新建MVC项目 Package Manager Console不能使用 (HRESULT: 0x80131500)
Visual studio 2015 突然新建不了MVC项目,报出错误: HRESULT: 0x80131500 在折腾了很长时间,最后在Github上看到这样一个贴 地址:https://githu ...
- Error: Could not access the Package Manager. Is the system running?
最近在搭建cordova,android 开发环境,安装android studio之后创建一个demo之后,运行想看一下效果,在运行过程中创建一个虚拟机(arm)的,等了有1分钟左右,再次运行程序, ...
- Visual Studio 2010 更新NuGet Package Manager出错解决办法
在Visual Studio 2010的扩展管理器中发现NuGet Package Manger有最新版本更新提示,选择更新安装提示以下错误信息: 2013/4/25 1:11:48 - Micros ...
- Getting and installing the PEAR package manager
Windows After you have downloaded and installed PHP, you have to manually execute the batch file loc ...
- RPM是RedHat Package Manager(RedHat软件包管理工具)
RPM是RedHat Package Manager(RedHat软件包管理工具)类似Windows里面的“添加/删除程序” rpm 执行安装包二进制包(Binary)以及源代码包(Source)两种 ...
- installation - How to install Synaptic Package Manager? - Ask Ubuntu
installation - How to install Synaptic Package Manager? - Ask Ubuntu How to install Synaptic Package ...
- A package manager for Qt
官网 http://www.qpm.io/ A package manager for Qt 注释:这个网站类似JavaScript的包管理器的网站https://www.npmjs.com/ 都是给 ...
随机推荐
- python基础===Windows环境下使用pip install 安装出错"Cannot unpack file"解决办法
不知道为什么,加了豆瓣镜像源还是不行 这个命令可以解决! pip install -i http://pypi.douban.com/simple/ --trusted-host pypi.douba ...
- linux子系统的初始化_subsys_initcall()【转】
转自:http://my.oschina.net/u/572632/blog/305492 目录[-] 概述 section的声明 注册 调用 IN BUILDING 概述 内核选项的解析完成之后,各 ...
- printk一些技巧【转】
转自:http://haohetao.iteye.com/blog/1147791 转自:http://blog.csdn.net/wbd880419/article/details/73530550 ...
- Python的数值和字符串
Python数据类型 1.数值 --类型: 1/整型 2/长整型 3/浮点型 -- 0.0, 12.0, -18.8, 3e+7等 4/复数型 -- complex In []: 0x34al ...
- tornado 模版
tornado 模版语法 取消转义 : 取消项目转义 :autoescape = None 取消模版转义:{% autoescape None %} 取消行转义 :{% raw bd %} 强制转 ...
- Fel表达式使用过程中需要注意的问题
精度问题: 我们知道java中直接使用float和double参与的计算都可能会产生精度问题,比如0.1+0.3.1.0-0.9 等.所以一般财务系统,都会使用BigDecimal进行加减乘除. 在调 ...
- poj 1724(最短路+优先队列)
ROADS Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13436 Accepted: 4921 Descriptio ...
- css3之nth-child和nth-of-type的区别
之前一直开发的是兼容老版本的代码,所以很少用到有关c3里面的代码格式,今天就对于使用的c3选择器中nth-child和nth-of-type做一个区分.首先:1.nth-child(n):是选择父级元 ...
- java 连接 kerberos 认证的 HBase 和 HDFS
这是两个功能,都很简单就写一块了.. 简单到什么程度呢,简单到只贴代码就可以了... HBase package com.miras.data; import org.apache.hadoop.co ...
- npoi的基本操作
////自动换行 ////自动换行翻译成英文其实就是Wrap的意思,所以这里我们应该用WrapText属性,这是一个布尔属性 //style6. ...