destructure rover in function param list
This commit is contained in:
parent
9348808ea9
commit
5a148a2688
@ -8,11 +8,8 @@ mod rover {
|
||||
|
||||
type Rover = (i32, i32, Facing);
|
||||
|
||||
pub fn forward(r : Rover) -> Rover {
|
||||
match r {
|
||||
(lon, lat, direction) =>
|
||||
(lon as i32, lat - 1 as i32, direction)
|
||||
}
|
||||
pub fn forward((lon, lat, direction) : Rover) -> Rover {
|
||||
(lon as i32, lat - 1 as i32, direction)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user