auto merge of #9939 : sinma/rust/doc, r=alexcrichton
Recently, the float type, and the rust and rusti tools have been removed from master. float replaced by f64 in code examples, removed mentions of float, f suffix, rust and rusti in explanations. (+ some stupid things like rust -> Rust)
This commit is contained in:
commit
404a4619dc
@ -39,18 +39,18 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"# trait Shape { fn area(&self) -> float; }\n"
|
||||
"# trait Circle : Shape { fn radius(&self) -> float; }\n"
|
||||
"fn radius_times_area<T: Circle>(c: T) -> float {\n"
|
||||
"# trait Shape { fn area(&self) -> f64; }\n"
|
||||
"# trait Circle : Shape { fn radius(&self) -> f64; }\n"
|
||||
"fn radius_times_area<T: Circle>(c: T) -> f64 {\n"
|
||||
" // `c` is both a Circle and a Shape\n"
|
||||
" c.radius() * c.area()\n"
|
||||
"}\n"
|
||||
"~~~\n"
|
||||
msgstr ""
|
||||
"~~~\n"
|
||||
"# trait Shape { fn area(&self) -> float; }\n"
|
||||
"# trait Circle : Shape { fn radius(&self) -> float; }\n"
|
||||
"fn radius_times_area<T: Circle>(c: T) -> float {\n"
|
||||
"# trait Shape { fn area(&self) -> f64; }\n"
|
||||
"# trait Circle : Shape { fn radius(&self) -> f64; }\n"
|
||||
"fn radius_times_area<T: Circle>(c: T) -> f64 {\n"
|
||||
" // `c` は Circle でもあり、Shape でもある\n"
|
||||
" c.radius() * c.area()\n"
|
||||
"}\n"
|
||||
@ -369,9 +369,7 @@ msgstr ""
|
||||
msgid ""
|
||||
"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 both as a unified interface for them, and for a few common "
|
||||
"command line scenarios."
|
||||
"and `rustpkg`, the Rust package manager."
|
||||
msgstr ""
|
||||
"ビルド完了後、`make install` を実行すると、以下のプログラムが `/usr/local/"
|
||||
"bin` にインストールされます。\n"
|
||||
@ -379,9 +377,6 @@ msgstr ""
|
||||
"* `rustc`: Rust のコンパイラ\n"
|
||||
"* `rustdoc`: API ドキュメント作成ツール\n"
|
||||
"* `rustpkg`: Rust のパッケージマネージャ\n"
|
||||
"* `rust`: Rust の REPL\n"
|
||||
"* `rust`: Rust のツール群への共通のインターフェースと、いくつかのコマンドライ"
|
||||
"ンシナリオを提供するツール"
|
||||
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:123
|
||||
@ -491,12 +486,12 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:169
|
||||
msgid ""
|
||||
"The `rust` tool provides central access to the other rust tools, as well as "
|
||||
"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."
|
||||
msgstr ""
|
||||
"`rust` ツールには、rust ツール群を統一的なインターフェースで呼び出す機能だけ"
|
||||
"`rust` ツールには、Rust ツール群を統一的なインターフェースで呼び出す機能だけ"
|
||||
"でなく、ソースファイルを直接実行する便利なショートカット機能もあります。例え"
|
||||
"ば、カレントディレクトリにある `foo.rs` を実行しようとする場合、 `rust run "
|
||||
"foo.rs` を実行することで、コンパイルから、コンパイル成功後に生成されるバイナ"
|
||||
@ -667,11 +662,11 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:243
|
||||
msgid ""
|
||||
"~~~~ static MONSTER_FACTOR: float = 57.8; let monster_size = MONSTER_FACTOR "
|
||||
"~~~~ static MONSTER_FACTOR: f64 = 57.8; let monster_size = MONSTER_FACTOR "
|
||||
"* 10.0; let monster_size: int = 50; ~~~~"
|
||||
msgstr ""
|
||||
"~~~~\n"
|
||||
"static MONSTER_FACTOR: float = 57.8;\n"
|
||||
"static MONSTER_FACTOR: f64 = 57.8;\n"
|
||||
"let monster_size = MONSTER_FACTOR * 10.0;\n"
|
||||
"let monster_size: int = 50;\n"
|
||||
"~~~~"
|
||||
@ -680,7 +675,7 @@ msgstr ""
|
||||
#: doc/tutorial.md:252
|
||||
msgid ""
|
||||
"Local variables may shadow earlier declarations, as in the previous example: "
|
||||
"`monster_size` was first declared as a `float`, and then a second "
|
||||
"`monster_size` was first declared as a `f64`, and then a second "
|
||||
"`monster_size` was declared as an `int`. If you were to actually compile "
|
||||
"this example, though, the compiler would determine that the first "
|
||||
"`monster_size` is unused and issue a warning (because this situation is "
|
||||
@ -689,7 +684,7 @@ msgid ""
|
||||
"the warning, like `let _monster_size = 50;`."
|
||||
msgstr ""
|
||||
"ローカル変数は、先行する宣言を隠すことがあります。先の例では、1つ目の "
|
||||
"`monster_size` は `float` として宣言され、2つ目の `monster_size` は `int` と"
|
||||
"`monster_size` は `f64` として宣言され、2つ目の `monster_size` は `int` と"
|
||||
"して宣言されています。このプログラムをコンパイルした場合、「1つ目の "
|
||||
"`monster_size` は未使用である」という警告メッセージが出力されます (プログラマ"
|
||||
"が何らかの誤りを犯している可能性があるため)。未使用変数の存在が意図的なもので"
|
||||
@ -899,15 +894,15 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:349
|
||||
msgid ""
|
||||
"There are three floating-point types: `float`, `f32`, and `f64`. Floating-"
|
||||
"There are two floating-point types: `f32`, and `f64`. Floating-"
|
||||
"point numbers are written `0.0`, `1e6`, or `2.1e-4`. Like integers, "
|
||||
"floating-point literals are inferred to the correct type. Suffixes `f`, "
|
||||
"floating-point literals are inferred to the correct type. Suffixes "
|
||||
"`f32`, and `f64` can be used to create literals of a specific type."
|
||||
msgstr ""
|
||||
"浮動小数型は、 `float`, `f32`, `f64` の3種類があります。浮動小数リテラルは "
|
||||
"浮動小数型は、 `f32`, `f64` の2種類があります。浮動小数リテラルは "
|
||||
"`0.0` や、 `1e6`、 `2.1e-4` といった表記が可能です。整数と同じく、サフィック"
|
||||
"スが省略された浮動小数リテラルは型推論されます。浮動小数のサフィックスは "
|
||||
"`f`、`f32`、`f64` の3種類で、リテラルの末尾につけることで、対応する型の値を作"
|
||||
"`f32`、`f64` の3種類で、リテラルの末尾につけることで、対応する型の値を作"
|
||||
"り出すことができます。"
|
||||
|
||||
#. type: Plain text
|
||||
@ -991,10 +986,10 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:385
|
||||
msgid ""
|
||||
"~~~~ let x: float = 4.0; let y: uint = x as uint; assert!(y == 4u); ~~~~"
|
||||
"~~~~ let x: f64 = 4.0; let y: uint = x as uint; assert!(y == 4u); ~~~~"
|
||||
msgstr ""
|
||||
"~~~~\n"
|
||||
"let x: float = 4.0;\n"
|
||||
"let x: f64 = 4.0;\n"
|
||||
"let y: uint = x as uint;\n"
|
||||
"assert!(y == 4u);\n"
|
||||
"~~~~"
|
||||
@ -1245,11 +1240,11 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:500
|
||||
msgid ""
|
||||
"> ***Note:*** The following code makes use of tuples (`(float, float)`) "
|
||||
"> ***Note:*** The following code makes use of tuples (`(f64, f64)`) "
|
||||
"which > are explained in section 5.3. For now you can think of tuples as a "
|
||||
"list of > items."
|
||||
msgstr ""
|
||||
"> ***注意:*** 以下のコード例では5.3 節で説明されるタプル (`(float, float)`) "
|
||||
"> ***注意:*** 以下のコード例では5.3 節で説明されるタプル (`(f64, f64)`) "
|
||||
"を使っています。現時点では、タプルは項目のリストのようなものだとみなしてくだ"
|
||||
"さい。"
|
||||
|
||||
@ -1258,10 +1253,10 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"use std::float;\n"
|
||||
"use std::f64;\n"
|
||||
"use std::num::atan;\n"
|
||||
"fn angle(vector: (float, float)) -> float {\n"
|
||||
" let pi = float::consts::pi;\n"
|
||||
"fn angle(vector: (f64, f64)) -> f64 {\n"
|
||||
" let pi = f64::consts::pi;\n"
|
||||
" match vector {\n"
|
||||
" (0f, y) if y < 0f => 1.5 * pi,\n"
|
||||
" (0f, y) => 0.5 * pi,\n"
|
||||
@ -1438,8 +1433,8 @@ msgstr ""
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"struct Point {\n"
|
||||
" x: float,\n"
|
||||
" y: float\n"
|
||||
" x: f64,\n"
|
||||
" y: f64\n"
|
||||
"}\n"
|
||||
"~~~~\n"
|
||||
msgstr ""
|
||||
@ -1471,11 +1466,11 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:602
|
||||
msgid ""
|
||||
"~~~~ {.xfail-test} # struct Point { x: float, y: float } let mut mypoint = "
|
||||
"~~~~ {.xfail-test} # struct Point { x: f64, y: f64 } let mut mypoint = "
|
||||
"Point { x: 1.0, y: 1.0 }; let origin = Point { x: 0.0, y: 0.0 };"
|
||||
msgstr ""
|
||||
"~~~~ {.xfail-test}\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"let mut mypoint = Point { x: 1.0, y: 1.0 };\n"
|
||||
"let origin = Point { x: 0.0, y: 0.0 };"
|
||||
|
||||
@ -1504,7 +1499,7 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# let mypoint = Point { x: 0.0, y: 0.0 };\n"
|
||||
"match mypoint {\n"
|
||||
" Point { x: 0.0, y: yy } => { println(yy.to_str()); }\n"
|
||||
@ -1533,7 +1528,7 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# let mypoint = Point { x: 0.0, y: 0.0 };\n"
|
||||
"match mypoint {\n"
|
||||
" Point { x, _ } => { println(x.to_str()) }\n"
|
||||
@ -1560,9 +1555,9 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"enum Shape {\n"
|
||||
" Circle(Point, float),\n"
|
||||
" Circle(Point, f64),\n"
|
||||
" Rectangle(Point, Point)\n"
|
||||
"}\n"
|
||||
"~~~~\n"
|
||||
@ -1572,12 +1567,12 @@ msgstr ""
|
||||
#: doc/tutorial.md:652
|
||||
msgid ""
|
||||
"A value of this type is either a `Circle`, in which case it contains a "
|
||||
"`Point` struct and a float, or a `Rectangle`, in which case it contains two "
|
||||
"`Point` struct and a `f64`, or a `Rectangle`, in which case it contains two "
|
||||
"`Point` structs. The run-time representation of such a value includes an "
|
||||
"identifier of the actual form that it holds, much like the \"tagged union\" "
|
||||
"pattern in C, but with better static guarantees."
|
||||
msgstr ""
|
||||
"この型の値は、`Point` 構造体と `float` を含む `Circle` か、2つの `Point` 構造"
|
||||
"この型の値は、`Point` 構造体と `f64` を含む `Circle` か、2つの `Point` 構造"
|
||||
"体を含む `Rectangle` のどちらかになります。列挙型の値の実行時表現には、値がど"
|
||||
"の形式をとっているのか示す識別子が含まれます。この表現方法は C の \"タグ付き"
|
||||
"共用体\" と非常によく似ていますが、Rust の列挙型はコンパイラにより値の正当性"
|
||||
@ -1689,12 +1684,12 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"use std::float;\n"
|
||||
"# struct Point {x: float, y: float}\n"
|
||||
"# enum Shape { Circle(Point, float), Rectangle(Point, Point) }\n"
|
||||
"fn area(sh: Shape) -> float {\n"
|
||||
"use std::f64;\n"
|
||||
"# struct Point {x: f64, y: f64}\n"
|
||||
"# enum Shape { Circle(Point, f64), Rectangle(Point, Point) }\n"
|
||||
"fn area(sh: Shape) -> f64 {\n"
|
||||
" match sh {\n"
|
||||
" Circle(_, size) => float::consts::pi * size * size,\n"
|
||||
" Circle(_, size) => f64::consts::pi * size * size,\n"
|
||||
" Rectangle(Point { x, y }, Point { x: x2, y: y2 }) => (x2 - x) * (y2 - y)\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
@ -1719,7 +1714,7 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# enum Direction { North, East, South, West }\n"
|
||||
"fn point_from_direction(dir: Direction) -> Point {\n"
|
||||
" match dir {\n"
|
||||
@ -1742,16 +1737,16 @@ msgstr "以下の例のように、列挙型バリアントを構造体にする
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"use std::float;\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# fn square(x: float) -> float { x * x }\n"
|
||||
"use std::f64;\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# fn square(x: f64) -> f64 { x * x }\n"
|
||||
"enum Shape {\n"
|
||||
" Circle { center: Point, radius: float },\n"
|
||||
" Circle { center: Point, radius: f64 },\n"
|
||||
" Rectangle { top_left: Point, bottom_right: Point }\n"
|
||||
"}\n"
|
||||
"fn area(sh: Shape) -> float {\n"
|
||||
"fn area(sh: Shape) -> f64 {\n"
|
||||
" match sh {\n"
|
||||
" Circle { radius: radius, _ } => float::consts::pi * square(radius),\n"
|
||||
" Circle { radius: radius, _ } => f64::consts::pi * square(radius),\n"
|
||||
" Rectangle { top_left: top_left, bottom_right: bottom_right } => {\n"
|
||||
" (bottom_right.x - top_left.x) * (bottom_right.y - top_left.y)\n"
|
||||
" }\n"
|
||||
@ -1783,7 +1778,7 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"let mytup: (int, int, float) = (10, 20, 30.0);\n"
|
||||
"let mytup: (int, int, f64) = (10, 20, 30.0);\n"
|
||||
"match mytup {\n"
|
||||
" (a, b, c) => info!(a + b + (c as int))\n"
|
||||
"}\n"
|
||||
@ -1814,7 +1809,7 @@ msgstr ""
|
||||
msgid ""
|
||||
"For example:\n"
|
||||
"~~~~\n"
|
||||
"struct MyTup(int, int, float);\n"
|
||||
"struct MyTup(int, int, f64);\n"
|
||||
"let mytup: MyTup = MyTup(10, 20, 30.0);\n"
|
||||
"match mytup {\n"
|
||||
" MyTup(a, b, c) => info!(a + b + (c as int))\n"
|
||||
@ -1822,7 +1817,7 @@ msgid ""
|
||||
"~~~~\n"
|
||||
msgstr ""
|
||||
"~~~~\n"
|
||||
"struct MyTup(int, int, float);\n"
|
||||
"struct MyTup(int, int, f64);\n"
|
||||
"let mytup: MyTup = MyTup(10, 20, 30.0);\n"
|
||||
"match mytup {\n"
|
||||
" MyTup(a, b, c) => info!(a + b + (c as int))\n"
|
||||
@ -2023,10 +2018,10 @@ msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:866
|
||||
msgid "~~~ fn first((value, _): (int, float)) -> int { value } ~~~"
|
||||
msgid "~~~ fn first((value, _): (int, f64)) -> int { value } ~~~"
|
||||
msgstr ""
|
||||
"~~~\n"
|
||||
"fn first((value, _): (int, float)) -> int { value }\n"
|
||||
"fn first((value, _): (int, f64)) -> int { value }\n"
|
||||
"~~~"
|
||||
|
||||
#. type: Plain text
|
||||
@ -2521,8 +2516,8 @@ msgstr "例として、シンプルな構造体型の `Point` について考え
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"struct Point {\n"
|
||||
" x: float,\n"
|
||||
" y: float\n"
|
||||
" x: f64,\n"
|
||||
" y: f64\n"
|
||||
"}\n"
|
||||
"~~~~\n"
|
||||
msgstr ""
|
||||
@ -2543,7 +2538,7 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"let on_the_stack : Point = Point { x: 3.0, y: 4.0 };\n"
|
||||
"let managed_box : @Point = @Point { x: 5.0, y: 1.0 };\n"
|
||||
"let owned_box : ~Point = ~Point { x: 7.0, y: 9.0 };\n"
|
||||
@ -2579,9 +2574,9 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# fn sqrt(f: float) -> float { 0f }\n"
|
||||
"fn compute_distance(p1: &Point, p2: &Point) -> float {\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# fn sqrt(f: f64) -> f64 { 0f }\n"
|
||||
"fn compute_distance(p1: &Point, p2: &Point) -> f64 {\n"
|
||||
" let x_d = p1.x - p2.x;\n"
|
||||
" let y_d = p1.y - p2.y;\n"
|
||||
" sqrt(x_d * x_d + y_d * y_d)\n"
|
||||
@ -2600,11 +2595,11 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"# struct Point{ x: float, y: float };\n"
|
||||
"# struct Point{ x: f64, y: f64 };\n"
|
||||
"# let on_the_stack : Point = Point { x: 3.0, y: 4.0 };\n"
|
||||
"# let managed_box : @Point = @Point { x: 5.0, y: 1.0 };\n"
|
||||
"# let owned_box : ~Point = ~Point { x: 7.0, y: 9.0 };\n"
|
||||
"# fn compute_distance(p1: &Point, p2: &Point) -> float { 0f }\n"
|
||||
"# fn compute_distance(p1: &Point, p2: &Point) -> f64 { 0f }\n"
|
||||
"compute_distance(&on_the_stack, managed_box);\n"
|
||||
"compute_distance(managed_box, owned_box);\n"
|
||||
"~~~\n"
|
||||
@ -2824,13 +2819,13 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:1209
|
||||
msgid ""
|
||||
"~~~ # struct Point { x: float, y: float } # enum Shape { Rectangle(Point, "
|
||||
"~~~ # struct Point { x: f64, y: f64 } # enum Shape { Rectangle(Point, "
|
||||
"Point) } # impl Shape { fn area(&self) -> int { 0 } } let start = @Point "
|
||||
"{ x: 10f, y: 20f }; let end = ~Point { x: (*start).x + 100f, y: (*start).y + "
|
||||
"100f }; let rect = &Rectangle(*start, *end); let area = (*rect).area(); ~~~"
|
||||
msgstr ""
|
||||
"~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# enum Shape { Rectangle(Point, Point) }\n"
|
||||
"# impl Shape { fn area(&self) -> int { 0 } }\n"
|
||||
"let start = @Point { x: 10f, y: 20f };\n"
|
||||
@ -2853,13 +2848,13 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:1223
|
||||
msgid ""
|
||||
"~~~ # struct Point { x: float, y: float } # enum Shape { Rectangle(Point, "
|
||||
"~~~ # struct Point { x: f64, y: f64 } # enum Shape { Rectangle(Point, "
|
||||
"Point) } # impl Shape { fn area(&self) -> int { 0 } } let start = @Point "
|
||||
"{ x: 10f, y: 20f }; let end = ~Point { x: start.x + 100f, y: start.y + "
|
||||
"100f }; let rect = &Rectangle(*start, *end); let area = rect.area(); ~~~"
|
||||
msgstr ""
|
||||
"~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# enum Shape { Rectangle(Point, Point) }\n"
|
||||
"# impl Shape { fn area(&self) -> int { 0 } }\n"
|
||||
"let start = @Point { x: 10f, y: 20f };\n"
|
||||
@ -2881,11 +2876,11 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:1233
|
||||
msgid ""
|
||||
"~~~ # struct Point { x: float, y: float } let point = &@~Point { x: 10f, y: "
|
||||
"~~~ # struct Point { x: f64, y: f64 } let point = &@~Point { x: 10f, y: "
|
||||
"20f }; println(fmt!(\"%f\", point.x)); ~~~"
|
||||
msgstr ""
|
||||
"~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"let point = &@~Point { x: 10f, y: 20f };\n"
|
||||
"println(fmt!(\"%f\", point.x));\n"
|
||||
"~~~"
|
||||
@ -3764,11 +3759,11 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"# fn draw_circle(p: Point, f: float) { }\n"
|
||||
"# fn draw_circle(p: Point, f: f64) { }\n"
|
||||
"# fn draw_rectangle(p: Point, p: Point) { }\n"
|
||||
"struct Point {\n"
|
||||
" x: float,\n"
|
||||
" y: float\n"
|
||||
" x: f64,\n"
|
||||
" y: f64\n"
|
||||
"}\n"
|
||||
msgstr ""
|
||||
|
||||
@ -3777,7 +3772,7 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"enum Shape {\n"
|
||||
" Circle(Point, float),\n"
|
||||
" Circle(Point, f64),\n"
|
||||
" Rectangle(Point, Point)\n"
|
||||
"}\n"
|
||||
msgstr ""
|
||||
@ -3832,11 +3827,11 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"# fn draw_circle(p: Point, f: float) { }\n"
|
||||
"# fn draw_circle(p: Point, f: f64) { }\n"
|
||||
"# fn draw_rectangle(p: Point, p: Point) { }\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# enum Shape {\n"
|
||||
"# Circle(Point, float),\n"
|
||||
"# Circle(Point, f64),\n"
|
||||
"# Rectangle(Point, Point)\n"
|
||||
"# }\n"
|
||||
"impl Shape {\n"
|
||||
@ -3878,11 +3873,11 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"# fn draw_circle(p: Point, f: float) { }\n"
|
||||
"# fn draw_circle(p: Point, f: f64) { }\n"
|
||||
"# fn draw_rectangle(p: Point, p: Point) { }\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# enum Shape {\n"
|
||||
"# Circle(Point, float),\n"
|
||||
"# Circle(Point, f64),\n"
|
||||
"# Rectangle(Point, Point)\n"
|
||||
"# }\n"
|
||||
"# impl Shape {\n"
|
||||
@ -3896,11 +3891,11 @@ msgid ""
|
||||
"// are automatically converted to borrowed pointers\n"
|
||||
msgstr ""
|
||||
"~~~\n"
|
||||
"# fn draw_circle(p: Point, f: float) { }\n"
|
||||
"# fn draw_circle(p: Point, f: f64) { }\n"
|
||||
"# fn draw_rectangle(p: Point, p: Point) { }\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# enum Shape {\n"
|
||||
"# Circle(Point, float),\n"
|
||||
"# Circle(Point, f64),\n"
|
||||
"# Rectangle(Point, Point)\n"
|
||||
"# }\n"
|
||||
"# impl Shape {\n"
|
||||
@ -3962,8 +3957,8 @@ msgstr ""
|
||||
msgid ""
|
||||
"~~~~ {.xfail-test}\n"
|
||||
"impl Circle {\n"
|
||||
" fn area(&self) -> float { ... }\n"
|
||||
" fn new(area: float) -> Circle { ... }\n"
|
||||
" fn area(&self) -> f64 { ... }\n"
|
||||
" fn new(area: f64) -> Circle { ... }\n"
|
||||
"}\n"
|
||||
"~~~~\n"
|
||||
msgstr ""
|
||||
@ -3981,10 +3976,10 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"use std::float::consts::pi;\n"
|
||||
"struct Circle { radius: float }\n"
|
||||
"use std::f64::consts::pi;\n"
|
||||
"struct Circle { radius: f64 }\n"
|
||||
"impl Circle {\n"
|
||||
" fn new(area: float) -> Circle { Circle { radius: (area / pi).sqrt() } }\n"
|
||||
" fn new(area: f64) -> Circle { Circle { radius: (area / pi).sqrt() } }\n"
|
||||
"}\n"
|
||||
"let c = Circle::new(42.5);\n"
|
||||
"~~~~\n"
|
||||
@ -4122,9 +4117,9 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# enum Shape { Circle(Point, float), Rectangle(Point, Point) }\n"
|
||||
"fn radius(shape: Shape) -> Option<float> {\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# enum Shape { Circle(Point, f64), Rectangle(Point, Point) }\n"
|
||||
"fn radius(shape: Shape) -> Option<f64> {\n"
|
||||
" match shape {\n"
|
||||
" Circle(_, radius) => Some(radius),\n"
|
||||
" Rectangle(*) => None\n"
|
||||
@ -4558,24 +4553,24 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:2002
|
||||
msgid ""
|
||||
"~~~~ use std::float::consts::pi; trait Shape { fn new(area: float) -> "
|
||||
"Self; } struct Circle { radius: float } struct Square { length: float }"
|
||||
"~~~~ use std::f64::consts::pi; trait Shape { fn new(area: f64) -> "
|
||||
"Self; } struct Circle { radius: f64 } struct Square { length: f64 }"
|
||||
msgstr ""
|
||||
"~~~~\n"
|
||||
"use std::float::consts::pi;\n"
|
||||
"trait Shape { fn new(area: float) -> Self; }\n"
|
||||
"struct Circle { radius: float }\n"
|
||||
"struct Square { length: float }"
|
||||
"use std::f64::consts::pi;\n"
|
||||
"trait Shape { fn new(area: f64) -> Self; }\n"
|
||||
"struct Circle { radius: f64 }\n"
|
||||
"struct Square { length: f64 }"
|
||||
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:2009
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"impl Shape for Circle {\n"
|
||||
" fn new(area: float) -> Circle { Circle { radius: (area / pi).sqrt() } }\n"
|
||||
" fn new(area: f64) -> Circle { Circle { radius: (area / pi).sqrt() } }\n"
|
||||
"}\n"
|
||||
"impl Shape for Square {\n"
|
||||
" fn new(area: float) -> Square { Square { length: (area).sqrt() } }\n"
|
||||
" fn new(area: f64) -> Square { Square { length: (area).sqrt() } }\n"
|
||||
"}\n"
|
||||
msgstr ""
|
||||
|
||||
@ -4871,12 +4866,12 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:2150
|
||||
msgid ""
|
||||
"~~~~ trait Shape { fn area(&self) -> float; } trait Circle : Shape { fn "
|
||||
"radius(&self) -> float; } ~~~~"
|
||||
"~~~~ trait Shape { fn area(&self) -> f64; } trait Circle : Shape { fn "
|
||||
"radius(&self) -> f64; } ~~~~"
|
||||
msgstr ""
|
||||
"~~~~\n"
|
||||
"trait Shape { fn area(&self) -> float; }\n"
|
||||
"trait Circle : Shape { fn radius(&self) -> float; }\n"
|
||||
"trait Shape { fn area(&self) -> f64; }\n"
|
||||
"trait Circle : Shape { fn radius(&self) -> f64; }\n"
|
||||
"~~~~"
|
||||
|
||||
#. type: Plain text
|
||||
@ -4890,17 +4885,17 @@ msgstr "`Circle` トレイトの実装は、 `Shape` を実装した型につい
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"use std::float::consts::pi;\n"
|
||||
"# trait Shape { fn area(&self) -> float; }\n"
|
||||
"# trait Circle : Shape { fn radius(&self) -> float; }\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# fn square(x: float) -> float { x * x }\n"
|
||||
"struct CircleStruct { center: Point, radius: float }\n"
|
||||
"use std::f64::consts::pi;\n"
|
||||
"# trait Shape { fn area(&self) -> f64; }\n"
|
||||
"# trait Circle : Shape { fn radius(&self) -> f64; }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# fn square(x: f64) -> f64 { x * x }\n"
|
||||
"struct CircleStruct { center: Point, radius: f64 }\n"
|
||||
"impl Circle for CircleStruct {\n"
|
||||
" fn radius(&self) -> float { (self.area() / pi).sqrt() }\n"
|
||||
" fn radius(&self) -> f64 { (self.area() / pi).sqrt() }\n"
|
||||
"}\n"
|
||||
"impl Shape for CircleStruct {\n"
|
||||
" fn area(&self) -> float { pi * square(self.radius) }\n"
|
||||
" fn area(&self) -> f64 { pi * square(self.radius) }\n"
|
||||
"}\n"
|
||||
"~~~~\n"
|
||||
msgstr ""
|
||||
@ -4921,22 +4916,22 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:2196
|
||||
msgid ""
|
||||
"~~~ {.xfail-test} use std::float::consts::pi; # trait Shape { fn area(&self) "
|
||||
"-> float; } # trait Circle : Shape { fn radius(&self) -> float; } # struct "
|
||||
"Point { x: float, y: float } # struct CircleStruct { center: Point, radius: "
|
||||
"float } # impl Circle for CircleStruct { fn radius(&self) -> float { (self."
|
||||
"~~~ {.xfail-test} use std::f64::consts::pi; # trait Shape { fn area(&self) "
|
||||
"-> f64; } # trait Circle : Shape { fn radius(&self) -> f64; } # struct "
|
||||
"Point { x: f64, y: f64 } # struct CircleStruct { center: Point, radius: "
|
||||
"f64 } # impl Circle for CircleStruct { fn radius(&self) -> f64 { (self."
|
||||
"area() / pi).sqrt() } } # impl Shape for CircleStruct { fn area(&self) -> "
|
||||
"float { pi * square(self.radius) } }"
|
||||
"f64 { pi * square(self.radius) } }"
|
||||
msgstr ""
|
||||
"~~~ {.xfail-test}\n"
|
||||
"use std::float::consts::pi;\n"
|
||||
"# trait Shape { fn area(&self) -> float; }\n"
|
||||
"# trait Circle : Shape { fn radius(&self) -> float; }\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct CircleStruct { center: Point, radius: float }\n"
|
||||
"# impl Circle for CircleStruct { fn radius(&self) -> float { (self.area() / "
|
||||
"use std::f64::consts::pi;\n"
|
||||
"# trait Shape { fn area(&self) -> f64; }\n"
|
||||
"# trait Circle : Shape { fn radius(&self) -> f64; }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# struct CircleStruct { center: Point, radius: f64 }\n"
|
||||
"# impl Circle for CircleStruct { fn radius(&self) -> f64 { (self.area() / "
|
||||
"pi).sqrt() } }\n"
|
||||
"# impl Shape for CircleStruct { fn area(&self) -> float { pi * square(self."
|
||||
"# impl Shape for CircleStruct { fn area(&self) -> f64 { pi * square(self."
|
||||
"radius) } }"
|
||||
|
||||
#. type: Plain text
|
||||
@ -4981,11 +4976,11 @@ msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:2216
|
||||
msgid "~~~ #[deriving(Eq)] struct Circle { radius: float }"
|
||||
msgid "~~~ #[deriving(Eq)] struct Circle { radius: f64 }"
|
||||
msgstr ""
|
||||
"~~~\n"
|
||||
"#[deriving(Eq)]\n"
|
||||
"struct Circle { radius: float }"
|
||||
"struct Circle { radius: f64 }"
|
||||
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:2220
|
||||
|
@ -36,9 +36,9 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"# trait Shape { fn area(&self) -> float; }\n"
|
||||
"# trait Circle : Shape { fn radius(&self) -> float; }\n"
|
||||
"fn radius_times_area<T: Circle>(c: T) -> float {\n"
|
||||
"# trait Shape { fn area(&self) -> f64; }\n"
|
||||
"# trait Circle : Shape { fn radius(&self) -> f64; }\n"
|
||||
"fn radius_times_area<T: Circle>(c: T) -> f64 {\n"
|
||||
" // `c` is both a Circle and a Shape\n"
|
||||
" c.radius() * c.area()\n"
|
||||
"}\n"
|
||||
@ -290,9 +290,7 @@ msgstr ""
|
||||
msgid ""
|
||||
"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 both as a unified interface for them, and for a few common "
|
||||
"command line scenarios."
|
||||
"and `rustpkg`, the Rust package manager."
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
@ -381,7 +379,7 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:169
|
||||
msgid ""
|
||||
"The `rust` tool provides central access to the other rust tools, as well as "
|
||||
"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."
|
||||
@ -506,7 +504,7 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:243
|
||||
msgid ""
|
||||
"~~~~ static MONSTER_FACTOR: float = 57.8; let monster_size = MONSTER_FACTOR "
|
||||
"~~~~ static MONSTER_FACTOR: f64 = 57.8; let monster_size = MONSTER_FACTOR "
|
||||
"* 10.0; let monster_size: int = 50; ~~~~"
|
||||
msgstr ""
|
||||
|
||||
@ -514,7 +512,7 @@ msgstr ""
|
||||
#: doc/tutorial.md:252
|
||||
msgid ""
|
||||
"Local variables may shadow earlier declarations, as in the previous example: "
|
||||
"`monster_size` was first declared as a `float`, and then a second "
|
||||
"`monster_size` was first declared as a `f64`, and then a second "
|
||||
"`monster_size` was declared as an `int`. If you were to actually compile "
|
||||
"this example, though, the compiler would determine that the first "
|
||||
"`monster_size` is unused and issue a warning (because this situation is "
|
||||
@ -678,10 +676,10 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:349
|
||||
msgid ""
|
||||
"There are three floating-point types: `float`, `f32`, and `f64`. Floating-"
|
||||
"There are two floating-point types: `f32`, and `f64`. Floating-"
|
||||
"point numbers are written `0.0`, `1e6`, or `2.1e-4`. Like integers, "
|
||||
"floating-point literals are inferred to the correct type. Suffixes `f`, "
|
||||
"`f32`, and `f64` can be used to create literals of a specific type."
|
||||
"floating-point literals are inferred to the correct type. Suffixes "
|
||||
"`f32` and `f64` can be used to create literals of a specific type."
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
@ -746,7 +744,7 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:385
|
||||
msgid ""
|
||||
"~~~~ let x: float = 4.0; let y: uint = x as uint; assert!(y == 4u); ~~~~"
|
||||
"~~~~ let x: f64 = 4.0; let y: uint = x as uint; assert!(y == 4u); ~~~~"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
@ -949,7 +947,7 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:500
|
||||
msgid ""
|
||||
"> ***Note:*** The following code makes use of tuples (`(float, float)`) "
|
||||
"> ***Note:*** The following code makes use of tuples (`(f64, f64)`) "
|
||||
"which > are explained in section 5.3. For now you can think of tuples as a "
|
||||
"list of > items."
|
||||
msgstr ""
|
||||
@ -959,10 +957,10 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"use std::float;\n"
|
||||
"use std::f64;\n"
|
||||
"use std::num::atan;\n"
|
||||
"fn angle(vector: (float, float)) -> float {\n"
|
||||
" let pi = float::consts::pi;\n"
|
||||
"fn angle(vector: (f64, f64)) -> f64 {\n"
|
||||
" let pi = f64::consts::pi;\n"
|
||||
" match vector {\n"
|
||||
" (0f, y) if y < 0f => 1.5 * pi,\n"
|
||||
" (0f, y) => 0.5 * pi,\n"
|
||||
@ -1104,8 +1102,8 @@ msgstr ""
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"struct Point {\n"
|
||||
" x: float,\n"
|
||||
" y: float\n"
|
||||
" x: f64,\n"
|
||||
" y: f64\n"
|
||||
"}\n"
|
||||
"~~~~\n"
|
||||
msgstr ""
|
||||
@ -1129,7 +1127,7 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:602
|
||||
msgid ""
|
||||
"~~~~ {.xfail-test} # struct Point { x: float, y: float } let mut mypoint = "
|
||||
"~~~~ {.xfail-test} # struct Point { x: f64, y: f64 } let mut mypoint = "
|
||||
"Point { x: 1.0, y: 1.0 }; let origin = Point { x: 0.0, y: 0.0 };"
|
||||
msgstr ""
|
||||
|
||||
@ -1152,7 +1150,7 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# let mypoint = Point { x: 0.0, y: 0.0 };\n"
|
||||
"match mypoint {\n"
|
||||
" Point { x: 0.0, y: yy } => { println(yy.to_str()); }\n"
|
||||
@ -1177,7 +1175,7 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# let mypoint = Point { x: 0.0, y: 0.0 };\n"
|
||||
"match mypoint {\n"
|
||||
" Point { x, _ } => { println(x.to_str()) }\n"
|
||||
@ -1202,9 +1200,9 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"enum Shape {\n"
|
||||
" Circle(Point, float),\n"
|
||||
" Circle(Point, f64),\n"
|
||||
" Rectangle(Point, Point)\n"
|
||||
"}\n"
|
||||
"~~~~\n"
|
||||
@ -1214,7 +1212,7 @@ msgstr ""
|
||||
#: doc/tutorial.md:652
|
||||
msgid ""
|
||||
"A value of this type is either a `Circle`, in which case it contains a "
|
||||
"`Point` struct and a float, or a `Rectangle`, in which case it contains two "
|
||||
"`Point` struct and a `f64`, or a `Rectangle`, in which case it contains two "
|
||||
"`Point` structs. The run-time representation of such a value includes an "
|
||||
"identifier of the actual form that it holds, much like the \"tagged union\" "
|
||||
"pattern in C, but with better static guarantees."
|
||||
@ -1307,12 +1305,12 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"use std::float;\n"
|
||||
"# struct Point {x: float, y: float}\n"
|
||||
"# enum Shape { Circle(Point, float), Rectangle(Point, Point) }\n"
|
||||
"fn area(sh: Shape) -> float {\n"
|
||||
"use std::f64;\n"
|
||||
"# struct Point {x: f64, y: f64}\n"
|
||||
"# enum Shape { Circle(Point, f64), Rectangle(Point, Point) }\n"
|
||||
"fn area(sh: Shape) -> f64 {\n"
|
||||
" match sh {\n"
|
||||
" Circle(_, size) => float::consts::pi * size * size,\n"
|
||||
" Circle(_, size) => f64::consts::pi * size * size,\n"
|
||||
" Rectangle(Point { x, y }, Point { x: x2, y: y2 }) => (x2 - x) * (y2 - y)\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
@ -1332,7 +1330,7 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# enum Direction { North, East, South, West }\n"
|
||||
"fn point_from_direction(dir: Direction) -> Point {\n"
|
||||
" match dir {\n"
|
||||
@ -1355,16 +1353,16 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"use std::float;\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# fn square(x: float) -> float { x * x }\n"
|
||||
"use std::f64;\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# fn square(x: f64) -> f64 { x * x }\n"
|
||||
"enum Shape {\n"
|
||||
" Circle { center: Point, radius: float },\n"
|
||||
" Circle { center: Point, radius: f64 },\n"
|
||||
" Rectangle { top_left: Point, bottom_right: Point }\n"
|
||||
"}\n"
|
||||
"fn area(sh: Shape) -> float {\n"
|
||||
"fn area(sh: Shape) -> f64 {\n"
|
||||
" match sh {\n"
|
||||
" Circle { radius: radius, _ } => float::consts::pi * square(radius),\n"
|
||||
" Circle { radius: radius, _ } => f64::consts::pi * square(radius),\n"
|
||||
" Rectangle { top_left: top_left, bottom_right: bottom_right } => {\n"
|
||||
" (bottom_right.x - top_left.x) * (bottom_right.y - top_left.y)\n"
|
||||
" }\n"
|
||||
@ -1392,7 +1390,7 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"let mytup: (int, int, float) = (10, 20, 30.0);\n"
|
||||
"let mytup: (int, int, f64) = (10, 20, 30.0);\n"
|
||||
"match mytup {\n"
|
||||
" (a, b, c) => info!(a + b + (c as int))\n"
|
||||
"}\n"
|
||||
@ -1419,7 +1417,7 @@ msgstr ""
|
||||
msgid ""
|
||||
"For example:\n"
|
||||
"~~~~\n"
|
||||
"struct MyTup(int, int, float);\n"
|
||||
"struct MyTup(int, int, f64);\n"
|
||||
"let mytup: MyTup = MyTup(10, 20, 30.0);\n"
|
||||
"match mytup {\n"
|
||||
" MyTup(a, b, c) => info!(a + b + (c as int))\n"
|
||||
@ -1574,7 +1572,7 @@ msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:866
|
||||
msgid "~~~ fn first((value, _): (int, float)) -> int { value } ~~~"
|
||||
msgid "~~~ fn first((value, _): (int, f64)) -> int { value } ~~~"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
@ -1935,8 +1933,8 @@ msgstr ""
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"struct Point {\n"
|
||||
" x: float,\n"
|
||||
" y: float\n"
|
||||
" x: f64,\n"
|
||||
" y: f64\n"
|
||||
"}\n"
|
||||
"~~~~\n"
|
||||
msgstr ""
|
||||
@ -1954,7 +1952,7 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"let on_the_stack : Point = Point { x: 3.0, y: 4.0 };\n"
|
||||
"let managed_box : @Point = @Point { x: 5.0, y: 1.0 };\n"
|
||||
"let owned_box : ~Point = ~Point { x: 7.0, y: 9.0 };\n"
|
||||
@ -1980,9 +1978,9 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# fn sqrt(f: float) -> float { 0f }\n"
|
||||
"fn compute_distance(p1: &Point, p2: &Point) -> float {\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# fn sqrt(f: f64) -> f64 { 0f }\n"
|
||||
"fn compute_distance(p1: &Point, p2: &Point) -> f64 {\n"
|
||||
" let x_d = p1.x - p2.x;\n"
|
||||
" let y_d = p1.y - p2.y;\n"
|
||||
" sqrt(x_d * x_d + y_d * y_d)\n"
|
||||
@ -2000,11 +1998,11 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"# struct Point{ x: float, y: float };\n"
|
||||
"# struct Point{ x: f64, y: f64 };\n"
|
||||
"# let on_the_stack : Point = Point { x: 3.0, y: 4.0 };\n"
|
||||
"# let managed_box : @Point = @Point { x: 5.0, y: 1.0 };\n"
|
||||
"# let owned_box : ~Point = ~Point { x: 7.0, y: 9.0 };\n"
|
||||
"# fn compute_distance(p1: &Point, p2: &Point) -> float { 0f }\n"
|
||||
"# fn compute_distance(p1: &Point, p2: &Point) -> f64 { 0f }\n"
|
||||
"compute_distance(&on_the_stack, managed_box);\n"
|
||||
"compute_distance(managed_box, owned_box);\n"
|
||||
"~~~\n"
|
||||
@ -2164,7 +2162,7 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:1209
|
||||
msgid ""
|
||||
"~~~ # struct Point { x: float, y: float } # enum Shape { Rectangle(Point, "
|
||||
"~~~ # struct Point { x: f64, y: f64 } # enum Shape { Rectangle(Point, "
|
||||
"Point) } # impl Shape { fn area(&self) -> int { 0 } } let start = @Point "
|
||||
"{ x: 10f, y: 20f }; let end = ~Point { x: (*start).x + 100f, y: (*start).y + "
|
||||
"100f }; let rect = &Rectangle(*start, *end); let area = (*rect).area(); ~~~"
|
||||
@ -2181,7 +2179,7 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:1223
|
||||
msgid ""
|
||||
"~~~ # struct Point { x: float, y: float } # enum Shape { Rectangle(Point, "
|
||||
"~~~ # struct Point { x: f64, y: f64 } # enum Shape { Rectangle(Point, "
|
||||
"Point) } # impl Shape { fn area(&self) -> int { 0 } } let start = @Point "
|
||||
"{ x: 10f, y: 20f }; let end = ~Point { x: start.x + 100f, y: start.y + "
|
||||
"100f }; let rect = &Rectangle(*start, *end); let area = rect.area(); ~~~"
|
||||
@ -2198,7 +2196,7 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:1233
|
||||
msgid ""
|
||||
"~~~ # struct Point { x: float, y: float } let point = &@~Point { x: 10f, y: "
|
||||
"~~~ # struct Point { x: f64, y: f64 } let point = &@~Point { x: 10f, y: "
|
||||
"20f }; println(fmt!(\"%f\", point.x)); ~~~"
|
||||
msgstr ""
|
||||
|
||||
@ -2883,11 +2881,11 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"# fn draw_circle(p: Point, f: float) { }\n"
|
||||
"# fn draw_circle(p: Point, f: f64) { }\n"
|
||||
"# fn draw_rectangle(p: Point, p: Point) { }\n"
|
||||
"struct Point {\n"
|
||||
" x: float,\n"
|
||||
" y: float\n"
|
||||
" x: f64,\n"
|
||||
" y: f64\n"
|
||||
"}\n"
|
||||
msgstr ""
|
||||
|
||||
@ -2896,7 +2894,7 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"enum Shape {\n"
|
||||
" Circle(Point, float),\n"
|
||||
" Circle(Point, f64),\n"
|
||||
" Rectangle(Point, Point)\n"
|
||||
"}\n"
|
||||
msgstr ""
|
||||
@ -2942,11 +2940,11 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"# fn draw_circle(p: Point, f: float) { }\n"
|
||||
"# fn draw_circle(p: Point, f: f64) { }\n"
|
||||
"# fn draw_rectangle(p: Point, p: Point) { }\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# enum Shape {\n"
|
||||
"# Circle(Point, float),\n"
|
||||
"# Circle(Point, f64),\n"
|
||||
"# Rectangle(Point, Point)\n"
|
||||
"# }\n"
|
||||
"impl Shape {\n"
|
||||
@ -2981,11 +2979,11 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~\n"
|
||||
"# fn draw_circle(p: Point, f: float) { }\n"
|
||||
"# fn draw_circle(p: Point, f: f64) { }\n"
|
||||
"# fn draw_rectangle(p: Point, p: Point) { }\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# enum Shape {\n"
|
||||
"# Circle(Point, float),\n"
|
||||
"# Circle(Point, f64),\n"
|
||||
"# Rectangle(Point, Point)\n"
|
||||
"# }\n"
|
||||
"# impl Shape {\n"
|
||||
@ -3035,8 +3033,8 @@ msgstr ""
|
||||
msgid ""
|
||||
"~~~~ {.xfail-test}\n"
|
||||
"impl Circle {\n"
|
||||
" fn area(&self) -> float { ... }\n"
|
||||
" fn new(area: float) -> Circle { ... }\n"
|
||||
" fn area(&self) -> f64 { ... }\n"
|
||||
" fn new(area: f64) -> Circle { ... }\n"
|
||||
"}\n"
|
||||
"~~~~\n"
|
||||
msgstr ""
|
||||
@ -3052,10 +3050,10 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"use std::float::consts::pi;\n"
|
||||
"struct Circle { radius: float }\n"
|
||||
"use std::f64::consts::pi;\n"
|
||||
"struct Circle { radius: f64 }\n"
|
||||
"impl Circle {\n"
|
||||
" fn new(area: float) -> Circle { Circle { radius: (area / pi).sqrt() } }\n"
|
||||
" fn new(area: f64) -> Circle { Circle { radius: (area / pi).sqrt() } }\n"
|
||||
"}\n"
|
||||
"let c = Circle::new(42.5);\n"
|
||||
"~~~~\n"
|
||||
@ -3166,9 +3164,9 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# enum Shape { Circle(Point, float), Rectangle(Point, Point) }\n"
|
||||
"fn radius(shape: Shape) -> Option<float> {\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# enum Shape { Circle(Point, f64), Rectangle(Point, Point) }\n"
|
||||
"fn radius(shape: Shape) -> Option<f64> {\n"
|
||||
" match shape {\n"
|
||||
" Circle(_, radius) => Some(radius),\n"
|
||||
" Rectangle(*) => None\n"
|
||||
@ -3503,8 +3501,8 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:2002
|
||||
msgid ""
|
||||
"~~~~ use std::float::consts::pi; trait Shape { fn new(area: float) -> "
|
||||
"Self; } struct Circle { radius: float } struct Square { length: float }"
|
||||
"~~~~ use std::f64::consts::pi; trait Shape { fn new(area: f64) -> "
|
||||
"Self; } struct Circle { radius: f64 } struct Square { length: f64 }"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
@ -3512,10 +3510,10 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"impl Shape for Circle {\n"
|
||||
" fn new(area: float) -> Circle { Circle { radius: (area / pi).sqrt() } }\n"
|
||||
" fn new(area: f64) -> Circle { Circle { radius: (area / pi).sqrt() } }\n"
|
||||
"}\n"
|
||||
"impl Shape for Square {\n"
|
||||
" fn new(area: float) -> Square { Square { length: (area).sqrt() } }\n"
|
||||
" fn new(area: f64) -> Square { Square { length: (area).sqrt() } }\n"
|
||||
"}\n"
|
||||
msgstr ""
|
||||
|
||||
@ -3738,8 +3736,8 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:2150
|
||||
msgid ""
|
||||
"~~~~ trait Shape { fn area(&self) -> float; } trait Circle : Shape { fn "
|
||||
"radius(&self) -> float; } ~~~~"
|
||||
"~~~~ trait Shape { fn area(&self) -> f64; } trait Circle : Shape { fn "
|
||||
"radius(&self) -> f64; } ~~~~"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
@ -3753,17 +3751,17 @@ msgstr ""
|
||||
#, no-wrap
|
||||
msgid ""
|
||||
"~~~~\n"
|
||||
"use std::float::consts::pi;\n"
|
||||
"# trait Shape { fn area(&self) -> float; }\n"
|
||||
"# trait Circle : Shape { fn radius(&self) -> float; }\n"
|
||||
"# struct Point { x: float, y: float }\n"
|
||||
"# fn square(x: float) -> float { x * x }\n"
|
||||
"struct CircleStruct { center: Point, radius: float }\n"
|
||||
"use std::f64::consts::pi;\n"
|
||||
"# trait Shape { fn area(&self) -> f64; }\n"
|
||||
"# trait Circle : Shape { fn radius(&self) -> f64; }\n"
|
||||
"# struct Point { x: f64, y: f64 }\n"
|
||||
"# fn square(x: f64) -> f64 { x * x }\n"
|
||||
"struct CircleStruct { center: Point, radius: f64 }\n"
|
||||
"impl Circle for CircleStruct {\n"
|
||||
" fn radius(&self) -> float { (self.area() / pi).sqrt() }\n"
|
||||
" fn radius(&self) -> f64 { (self.area() / pi).sqrt() }\n"
|
||||
"}\n"
|
||||
"impl Shape for CircleStruct {\n"
|
||||
" fn area(&self) -> float { pi * square(self.radius) }\n"
|
||||
" fn area(&self) -> f64 { pi * square(self.radius) }\n"
|
||||
"}\n"
|
||||
"~~~~\n"
|
||||
msgstr ""
|
||||
@ -3780,12 +3778,12 @@ msgstr ""
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:2196
|
||||
msgid ""
|
||||
"~~~ {.xfail-test} use std::float::consts::pi; # trait Shape { fn area(&self) "
|
||||
"-> float; } # trait Circle : Shape { fn radius(&self) -> float; } # struct "
|
||||
"Point { x: float, y: float } # struct CircleStruct { center: Point, radius: "
|
||||
"float } # impl Circle for CircleStruct { fn radius(&self) -> float { (self."
|
||||
"~~~ {.xfail-test} use std::f64::consts::pi; # trait Shape { fn area(&self) "
|
||||
"-> f64; } # trait Circle : Shape { fn radius(&self) -> f64; } # struct "
|
||||
"Point { x: f64, y: f64 } # struct CircleStruct { center: Point, radius: "
|
||||
"f64 } # impl Circle for CircleStruct { fn radius(&self) -> f64 { (self."
|
||||
"area() / pi).sqrt() } } # impl Shape for CircleStruct { fn area(&self) -> "
|
||||
"float { pi * square(self.radius) } }"
|
||||
"f64 { pi * square(self.radius) } }"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
@ -3819,7 +3817,7 @@ msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
#: doc/tutorial.md:2216
|
||||
msgid "~~~ #[deriving(Eq)] struct Circle { radius: float }"
|
||||
msgid "~~~ #[deriving(Eq)] struct Circle { radius: f64 }"
|
||||
msgstr ""
|
||||
|
||||
#. type: Plain text
|
||||
|
Loading…
Reference in New Issue
Block a user