|
15 | 15 | Synchronizing submodule url for 'submodules/api-common-protos' |
16 | 16 | ``` |
17 | 17 |
|
| 18 | +* [`EVChargerType` enum refactored](https://github.com/frequenz-floss/frequenz-api-common/pull/21) |
| 19 | + |
| 20 | + The enum with the oder variants was compiled into the following rust enum |
| 21 | + (by prost): |
| 22 | + ```rust |
| 23 | + pub enum EvChargerType { |
| 24 | + /// Default type. |
| 25 | + EvchargerTypeUnspecified = 0, |
| 26 | + /// The EV charging station supports AC charging only. |
| 27 | + EvchargerTypeAc = 1, |
| 28 | + /// The EV charging station supports DC charging only. |
| 29 | + EvchargerTypeDc = 2, |
| 30 | + /// The EV charging station supports both AC and DC. |
| 31 | + EvchargerTypeHybrid = 3, |
| 32 | + } |
| 33 | + ``` |
| 34 | + Here the enum variants were unnecessarily prefixed with `EvchargerType`. |
| 35 | + This lead to accessing the enum variants in a very verbose manner, e.g., |
| 36 | + `EvChargerType::EvchargerTypeHybrid`. |
| 37 | + |
| 38 | + The changed version of the enum in this commit results in the following |
| 39 | + rust enum: |
| 40 | + ```rust |
| 41 | + pub enum EvChargerType { |
| 42 | + /// Default type. |
| 43 | + Unspecified = 0, |
| 44 | + /// The EV charging station supports AC charging only. |
| 45 | + Ac = 1, |
| 46 | + /// The EV charging station supports DC charging only. |
| 47 | + Dc = 2, |
| 48 | + /// The EV charging station supports both AC and DC. |
| 49 | + Hybrid = 3, |
| 50 | + } |
| 51 | + ``` |
| 52 | + Here the unnecessary prefix `EvchargerType` is absent. This reduces the |
| 53 | + verbosity while accessing the enum variants, making the resulting rust code |
| 54 | + more readable, e.g., as `EvChargerType::Hybrid`. |
| 55 | + |
| 56 | + This change also leads to renaming the enum from `EVChargerType` to |
| 57 | + `EvChargerType`, to satisfy protolint requirements. |
18 | 58 | ## New Features |
19 | 59 |
|
20 | 60 | <!-- Here goes the main new features and examples or instructions on how to use them --> |
|
0 commit comments