Skip to content

Doc: Mention new rust tool in the tutorial #5040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 20, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ for more information on them.

When complete, `make install` will place several programs into
`/usr/local/bin`: `rustc`, the Rust compiler; `rustdoc`, the
API-documentation tool; `cargo`, the Rust package manager;
and `rusti`, the Rust REPL.
API-documentation tool; `rustpkg`, the Rust package manager;
`rusti`, the Rust REPL; and `rust`, a tool which acts both as a unified
interface for them, and for a few common command line scenarios.

[wiki-start]: https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust
[tarball]: http://static.rust-lang.org/dist/rust-0.5.tar.gz
Expand Down Expand Up @@ -154,6 +155,22 @@ declaration to appear at the top level of the file: all statements must
live inside a function. Rust programs can also be compiled as
libraries, and included in other programs.

## Using the rust tool

While using `rustc` directly to generate your executables, and then
running them manually is a perfectly valid way to test your code,
for smaller projects, prototypes, or if you're a beginner, it might be
more convenient to use the `rust` tool.

The `rust` tool provides central access to the other rust tools,
as well as handy shortcuts for directly running source files.
For example, if you have a file `foo.rs` in your current directory,
`rust run foo.rs` would attempt to compile it and, if successful,
directly run the resulting binary.

To get a list of all available commands, simply call `rust` without any
argument.

## Editing Rust code

There are vim highlighting and indentation scripts in the Rust source
Expand Down Expand Up @@ -2184,7 +2201,7 @@ impl Circle for CircleStruct {
}
impl Shape for CircleStruct {
fn area(&self) -> float { pi * square(self.radius) }
}
}
~~~~

Notice that methods of `Circle` can call methods on `Shape`, as our
Expand Down