Skip to content

Commit df8231e

Browse files
committed
auto merge of #9439 : steveklabnik/rust/build_rustpkg_tutorial, r=brson
Three things in this commit: 1. Actually build the rustpkg tutorial. I didn't know I needed this when I first wrote it. 2. Link to it rather than the manual from the tutorial. 3. Update the headers: most of them were one level too deeply nested.
2 parents c1b187d + 06b11ba commit df8231e

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

doc/tutorial-rustpkg.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ package up your Rust code and share it with other people. This tutorial will
77
get you started on all of the concepts and commands you need to give the gift
88
of Rust code to someone else.
99

10-
## Installing External Packages
10+
# Installing External Packages
1111

1212
First, let's try to use an external package somehow. I've made a sample package
1313
called `hello` to demonstrate how to do so. Here's how `hello` is used:
@@ -68,7 +68,7 @@ Hello, world.
6868

6969
Simple! That's all it takes.
7070

71-
## Workspaces
71+
# Workspaces
7272

7373
Before we can talk about how to make packages of your own, you have to
7474
understand the big concept with `rustpkg`: workspaces. A 'workspace' is simply
@@ -88,14 +88,14 @@ There are also default file names you'll want to follow as well:
8888
* `main.rs`: A file that's going to become an executable.
8989
* `lib.rs`: A file that's going to become a library.
9090

91-
## Building your own Package
91+
# Building your own Package
9292

9393
Now that you've got workspaces down, let's build your own copy of `hello`. Go
9494
to wherever you keep your personal projects, and let's make all of the
9595
directories we'll need. I'll refer to this personal project directory as
9696
`~/src` for the rest of this tutorial.
9797

98-
### Creating our workspace
98+
## Creating our workspace
9999

100100
~~~ {.notrust}
101101
$ cd ~/src
@@ -150,15 +150,15 @@ pub fn world() {
150150

151151
Put this into `src/hello/lib.rs`. Let's talk about each of these attributes:
152152

153-
### Crate attributes for packages
153+
## Crate attributes for packages
154154

155155
`license` is equally simple: the license we want this code to have. I chose MIT
156156
here, but you should pick whatever license makes the most sense for you.
157157

158158
`desc` is a description of the package and what it does. This should just be a
159159
sentence or two.
160160

161-
### Building your package
161+
## Building your package
162162

163163
Building your package is simple:
164164

@@ -206,7 +206,7 @@ note: Installed package github.com/YOUR_USERNAME/hello-0.1 to /home/yourusername
206206

207207
That's it!
208208

209-
## More resources
209+
# More resources
210210

211211
There's a lot more going on with `rustpkg`, this is just to get you started.
212212
Check out [the rustpkg manual](rustpkg.html) for the full details on how to

doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2995,7 +2995,7 @@ There is further documentation on the [wiki], however those tend to be even more
29952995
[tasks]: tutorial-tasks.html
29962996
[macros]: tutorial-macros.html
29972997
[ffi]: tutorial-ffi.html
2998-
[rustpkg]: rustpkg.html
2998+
[rustpkg]: tutorial-rustpkg.html
29992999

30003000
[wiki]: https://github.com/mozilla/rust/wiki/Docs
30013001

mk/docs.mk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,16 @@ doc/tutorial-conditions.html: tutorial-conditions.md doc/version_info.html doc/r
160160
--include-before-body=doc/version_info.html \
161161
--output=$@
162162

163+
DOCS += doc/tutorial-rustpkg.html
164+
doc/tutorial-rustpkg.html: tutorial-rustpkg.md doc/version_info.html doc/rust.css
165+
@$(call E, pandoc: $@)
166+
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
167+
$(CFG_PANDOC) --standalone --toc \
168+
--section-divs --number-sections \
169+
--from=markdown --to=html --css=rust.css \
170+
--include-before-body=doc/version_info.html \
171+
--output=$@
172+
163173
ifeq ($(CFG_PDFLATEX),)
164174
$(info cfg: no pdflatex found, omitting doc/rust.pdf)
165175
else

0 commit comments

Comments
 (0)