@@ -6,37 +6,42 @@ use phf::phf_map;
6
6
use serde:: { Deserialize , Deserializer , Serialize } ;
7
7
8
8
// -----------------------------------------------------------------------------
9
-
9
+ //
10
10
/// The `status` field within the Directions response object contains the
11
11
/// [status](https://developers.google.com/maps/documentation/directions/intro#StatusCodes)
12
12
/// of the request, and may contain debugging information to help you track down
13
13
/// why the Directions service failed.
14
-
15
14
#[ derive( Clone , Debug , Eq , Hash , Ord , PartialEq , PartialOrd , Serialize ) ]
15
+ #[ serde( rename_all( serialize = "SCREAMING_SNAKE_CASE" , deserialize = "SCREAMING_SNAKE_CASE" ) ) ]
16
16
pub enum Status {
17
17
/// Indicates that the provided request was invalid. Common causes of this
18
18
/// status include an invalid parameter or parameter value.
19
- #[ serde( alias = "INVALID_REQUEST " ) ]
19
+ #[ serde( alias = "InvalidRequest " ) ]
20
20
InvalidRequest ,
21
+
21
22
/// Indicates the requested route is too long and cannot be processed. This
22
23
/// error occurs when more complex directions are returned. Try reducing the
23
24
/// number of waypoints, turns, or instructions.
24
- #[ serde( alias = "MAX_ROUTE_LENGTH_EXCEEDED " ) ]
25
+ #[ serde( alias = "MaxRouteLengthExceeded " ) ]
25
26
MaxRouteLengthExceeded ,
27
+
26
28
/// Indicates that too many `waypoints` were provided in the request. For
27
29
/// applications using the Directions API as a web service, or the
28
30
/// [directions service in the Maps JavaScript API](https://developers.google.com/maps/documentation/javascript/directions),
29
31
/// the maximum allowed number of `waypoints` is 25, plus the origin and
30
32
/// destination.
31
- #[ serde( alias = "MAX_WAYPOINTS_EXCEEDED " ) ]
33
+ #[ serde( alias = "MaxWaypointsExceeded " ) ]
32
34
MaxWaypointsExceeded ,
35
+
33
36
/// Indicates at least one of the locations specified in the request's
34
37
/// origin, destination, or waypoints could not be geocoded.
35
- #[ serde( alias = "NOT_FOUND " ) ]
38
+ #[ serde( alias = "NotFound " ) ]
36
39
NotFound ,
40
+
37
41
/// Indicates the response contains a valid `result`.
38
- #[ serde( alias = "OK " ) ]
42
+ #[ serde( alias = "Ok " ) ]
39
43
Ok ,
44
+
40
45
/// Indicates any of the following:
41
46
/// * The API key is missing or invalid.
42
47
/// * Billing has not been enabled on your account.
@@ -47,22 +52,27 @@ pub enum Status {
47
52
/// See the [Maps
48
53
/// FAQ](https://developers.google.com/maps/faq#over-limit-key-error) to
49
54
/// learn how to fix this.
50
- #[ serde( alias = "OVER_DAILY_LIMIT" ) ]
55
+
56
+ #[ serde( alias = "OverDailyLimit" ) ]
51
57
OverDailyLimit ,
58
+
52
59
/// Indicates the service has received too many requests from your
53
60
/// application within the allowed time period.
54
- #[ serde( alias = "OVER_QUERY_LIMIT " ) ]
61
+ #[ serde( alias = "OverQueryLimit " ) ]
55
62
OverQueryLimit ,
63
+
56
64
/// Indicates that the service denied use of the directions service by your
57
65
/// application.
58
- #[ serde( alias = "REQUEST_DENIED " ) ]
66
+ #[ serde( alias = "RequestDenied " ) ]
59
67
RequestDenied ,
68
+
60
69
/// Indicates a directions request could not be processed due to a server
61
70
/// error. The request may succeed if you try again.
62
- #[ serde( alias = "UNKNOWN_ERROR " ) ]
71
+ #[ serde( alias = "UnknownError " ) ]
63
72
UnknownError ,
73
+
64
74
/// Indicates no route could be found between the origin and destination.
65
- #[ serde( alias = "ZERO_RESULTS " ) ]
75
+ #[ serde( alias = "ZeroResults " ) ]
66
76
ZeroResults ,
67
77
} // enum
68
78
0 commit comments