Chedy Souffargi
unread,Apr 19, 2024, 8:10:25 PMApr 19Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Protocol Buffers
I am working on a Rust project, using Protocol Buffers, and dealing with nested enums. Here's what I have so far in Rust:
enum Vehicle {
Car(CarType),
Truck(TruckType),
}
enum CarType {
Sedan,
Coupe,
Hatchback,
}
enum TruckType {
Pickup,
Semi,
}
fn create_vehicle_fleet() -> [Vehicle; 8] {
[
Vehicle::Car(CarType::Sedan),
Vehicle::Truck(TruckType::Pickup),
Vehicle::Car(CarType::Coupe),
Vehicle::Truck(TruckType::Semi),
Vehicle::Car(CarType::Hatchback),
Vehicle::Car(CarType::Sedan),
Vehicle::Truck(TruckType::Pickup),
Vehicle::Car(CarType::Coupe),
]
}
I cannot find a proper way to represent the Vehicle enum in protobuf. Can anyone suggest a solution or provide guidance on how to handle this situation in Protocol Buffers?