diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2011-11-01 12:26:17 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2011-11-01 12:46:46 +0100 |
| commit | e8e2cd44f48a6edcdd4477ab66f0fc5935ecd1a1 (patch) | |
| tree | 26c4cf692d124b6bbefc10b9a17b3e9e06044855 /doc/tutorial/data.md | |
| parent | 8b57cb90e50b600824c967470483462aeb663e50 (diff) | |
| download | rust-e8e2cd44f48a6edcdd4477ab66f0fc5935ecd1a1.tar.gz rust-e8e2cd44f48a6edcdd4477ab66f0fc5935ecd1a1.zip | |
Add syntax highlighting to the code snippets in the tutorial
Using the CodeMirror Rust mode.
Diffstat (limited to 'doc/tutorial/data.md')
| -rw-r--r-- | doc/tutorial/data.md | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/doc/tutorial/data.md b/doc/tutorial/data.md index d09359f198d..638db23cb08 100644 --- a/doc/tutorial/data.md +++ b/doc/tutorial/data.md @@ -13,11 +13,11 @@ types). ## Records -Rust record types are written `{field1: TYPE, field2: TYPE [, -...]}`, and record literals are written in the same way, but with -expressions instead of types. They are quite similar to C structs, and -even laid out the same way in memory (so you can read from a Rust -struct in C, and vice-versa). +Rust record types are written `{field1: TYPE, field2: TYPE [, ...]}`, +and record literals are written in the same way, but with expressions +instead of types. They are quite similar to C structs, and even laid +out the same way in memory (so you can read from a Rust struct in C, +and vice-versa). The dot operator is used to access record fields (`mypoint.x`). @@ -100,6 +100,8 @@ equivalent to an `enum` in C: This will define `north`, `east`, `south`, and `west` as constants, all of which have type `direction`. +<a name="single_variant_tag"></a> + There is a special case for tags with a single variant. These are used to define new types in such a way that the new name is not just a synonym for an existing type, but its own distinct type. If you say: |
