From f684a8a56be054997c1df8807eac9d5cad221979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20L=C3=B6bel?= Date: Tue, 19 Feb 2013 18:10:31 +0100 Subject: [PATCH 1/3] Mention rust tool in the tutorial --- doc/tutorial.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/tutorial.md b/doc/tutorial.md index 9550dd927fac3..895af6f1289d3 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -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 as a unified way to +call them, either directly or with common command line arguments. [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 @@ -2184,7 +2185,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 From 8ee2d58683cd2dfe981b4c84b7538f44c7ec9cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20L=C3=B6bel?= Date: Tue, 19 Feb 2013 20:57:23 +0100 Subject: [PATCH 2/3] Give the rust tool an own section in the tutorial. --- doc/tutorial.md | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/doc/tutorial.md b/doc/tutorial.md index 895af6f1289d3..ed6d3c9c7a047 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -115,8 +115,8 @@ 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; `rustpkg`, the Rust package manager; -`rusti`, the Rust REPL; and `rust`, a tool which acts as a unified way to -call them, either directly or with common command line arguments. +`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 @@ -155,6 +155,25 @@ 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. + +You use it by calling it with one of the supported commands, followed by +arguments for that command. For example `rust build foo.rs` calls the +`build` command with the argument `foo.rs`. + +The commands are: + - `build`, `doc`, `pkg` and `sketch`, which simply forward all arguments + to the included programs `rustc`, `rustdoc`, `rustpkg` and `rusti`. + - `run` and `test`, which both accept one source file and, using `rustc`, + produce either a normal or a test executable in the current working + directory and run it. + - `help`, which prints out the usage text of one of the commands. + ## Editing Rust code There are vim highlighting and indentation scripts in the Rust source From 34c39bb1c41cd3af81b00654301f9a39c64b932d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20L=C3=B6bel?= Date: Tue, 19 Feb 2013 22:19:19 +0100 Subject: [PATCH 3/3] Rewrited section about rust tool --- doc/tutorial.md | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/doc/tutorial.md b/doc/tutorial.md index ed6d3c9c7a047..648aa24a08fdb 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -162,17 +162,14 @@ 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. -You use it by calling it with one of the supported commands, followed by -arguments for that command. For example `rust build foo.rs` calls the -`build` command with the argument `foo.rs`. - -The commands are: - - `build`, `doc`, `pkg` and `sketch`, which simply forward all arguments - to the included programs `rustc`, `rustdoc`, `rustpkg` and `rusti`. - - `run` and `test`, which both accept one source file and, using `rustc`, - produce either a normal or a test executable in the current working - directory and run it. - - `help`, which prints out the usage text of one of the commands. +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