File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -859,12 +859,12 @@ get at their contents. All variant constructors can be used as
859
859
patterns, as in this definition of ` area ` :
860
860
861
861
~~~~
862
- # type Point = {x: float, y: float};
862
+ # struct Point {x: float, y: float}
863
863
# enum Shape { Circle(Point, float), Rectangle(Point, Point) }
864
864
fn area(sh: Shape) -> float {
865
865
match sh {
866
866
Circle(_, size) => float::consts::pi * size * size,
867
- Rectangle({x, y}, {x: x2, y: y2}) => (x2 - x) * (y2 - y)
867
+ Rectangle(Point {x, y}, Point {x: x2, y: y2}) => (x2 - x) * (y2 - y)
868
868
}
869
869
}
870
870
~~~~
@@ -875,7 +875,7 @@ their introductory form, nullary enum patterns are written without
875
875
parentheses.
876
876
877
877
~~~~
878
- # type Point = {x: float, y: float};
878
+ # struct Point {x: float, y: float}
879
879
# enum Direction { North, East, South, West }
880
880
fn point_from_direction(dir: Direction) -> Point {
881
881
match dir {
You can’t perform that action at this time.
0 commit comments