docs: Remove more uses of records

This commit is contained in:
Brian Anderson 2012-10-06 22:35:08 -07:00
parent 0b2ffa5692
commit ba26dc50ce
1 changed files with 3 additions and 3 deletions

View File

@ -859,12 +859,12 @@ get at their contents. All variant constructors can be used as
patterns, as in this definition of `area`: patterns, as in this definition of `area`:
~~~~ ~~~~
# type Point = {x: float, y: float}; # struct Point {x: float, y: float}
# enum Shape { Circle(Point, float), Rectangle(Point, Point) } # enum Shape { Circle(Point, float), Rectangle(Point, Point) }
fn area(sh: Shape) -> float { fn area(sh: Shape) -> float {
match sh { match sh {
Circle(_, size) => float::consts::pi * size * size, Circle(_, size) => float::consts::pi * size * size,
Rectangle({x, y}, {x: x2, y: y2}) => (x2 - x) * (y2 - y) Rectangle(Point {x, y}, Point {x: x2, y: y2}) => (x2 - x) * (y2 - y)
} }
} }
~~~~ ~~~~
@ -875,7 +875,7 @@ their introductory form, nullary enum patterns are written without
parentheses. parentheses.
~~~~ ~~~~
# type Point = {x: float, y: float}; # struct Point {x: float, y: float}
# enum Direction { North, East, South, West } # enum Direction { North, East, South, West }
fn point_from_direction(dir: Direction) -> Point { fn point_from_direction(dir: Direction) -> Point {
match dir { match dir {