Skip to main content

maliput/api/rules/
mod.rs

1// BSD 3-Clause License
2//
3// Copyright (c) 2024, Woven by Toyota.
4// All rights reserved.
5//
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions are met:
8//
9// * Redistributions of source code must retain the above copyright notice, this
10//   list of conditions and the following disclaimer.
11//
12// * Redistributions in binary form must reproduce the above copyright notice,
13//   this list of conditions and the following disclaimer in the documentation
14//   and/or other materials provided with the distribution.
15//
16// * Neither the name of the copyright holder nor the names of its
17//   contributors may be used to endorse or promote products derived from
18//   this software without specific prior written permission.
19//
20// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31use std::collections::HashMap;
32
33use crate::{api::RoadPosition, common::MaliputError};
34use strum_macros::{Display, EnumString, IntoStaticStr};
35
36/// Interface for accessing the [TrafficLight] in the [super::RoadNetwork]
37pub struct TrafficLightBook<'a> {
38    pub(super) traffic_light_book: &'a maliput_sys::api::rules::ffi::TrafficLightBook,
39}
40
41impl<'a> TrafficLightBook<'a> {
42    /// Gets all the [TrafficLight]s in the [TrafficLightBook]
43    ///
44    /// # Returns
45    /// A vector of [TrafficLight]s
46    pub fn traffic_lights(&self) -> Vec<TrafficLight<'_>> {
47        let traffic_lights_cpp = maliput_sys::api::rules::ffi::TrafficLightBook_TrafficLights(self.traffic_light_book);
48        traffic_lights_cpp
49            .into_iter()
50            .map(|tl| TrafficLight {
51                traffic_light: unsafe { tl.traffic_light.as_ref().expect("") },
52            })
53            .collect::<Vec<TrafficLight>>()
54    }
55
56    /// Gets a [TrafficLight] by its id.
57    ///
58    /// # Arguments
59    /// * `id` - The id of the [TrafficLight].
60    ///
61    /// # Returns
62    /// The [TrafficLight] with the given id.
63    /// If no [TrafficLight] is found with the given id, return None.
64    pub fn get_traffic_light(&self, id: &String) -> Option<TrafficLight<'_>> {
65        let traffic_light = maliput_sys::api::rules::ffi::TrafficLightBook_GetTrafficLight(self.traffic_light_book, id);
66        if traffic_light.is_null() {
67            return None;
68        }
69        Some(TrafficLight {
70            traffic_light: unsafe {
71                traffic_light
72                    .as_ref()
73                    .expect("Unable to get underlying traffic light pointer")
74            },
75        })
76    }
77
78    /// Gets all [TrafficLight]s whose `related_lanes()` includes the given lane ID.
79    ///
80    /// # Arguments
81    /// * `lane_id` - The lane ID to look up.
82    ///
83    /// # Returns
84    /// A vector of [TrafficLight]s associated with the given lane.
85    /// Returns an empty vector if no traffic lights are associated with the lane.
86    pub fn find_by_lane(&self, lane_id: &String) -> Vec<TrafficLight<'_>> {
87        let traffic_lights_cpp =
88            maliput_sys::api::rules::ffi::TrafficLightBook_FindByLane(self.traffic_light_book, lane_id);
89        traffic_lights_cpp
90            .into_iter()
91            .map(|tl| TrafficLight {
92                traffic_light: unsafe { tl.traffic_light.as_ref().expect("TrafficLight pointer is null") },
93            })
94            .collect::<Vec<TrafficLight>>()
95    }
96}
97
98/// Models a traffic light. A traffic light is a physical signaling device
99/// typically located at road intersections. It contains one or more groups of
100/// light bulbs with varying colors and shapes. The lighting patterns of the
101/// bulbs signify right-of-way rule information to the agents navigating the
102/// intersection (e.g., vehicles, bicyclists, pedestrians, etc.). Typically, an
103/// intersection will be managed by multiple traffic lights.
104///
105/// Note that traffic lights are physical manifestations of underlying
106/// right-of-way rules and thus naturally have lower signal-to-noise ratio
107/// relative to the underlying rules. Thus, oracular agents should directly use
108/// the underlying right-of-way rules instead of traffic lights when navigating
109/// intersections. TrafficLight exists for testing autonomous vehicles that do
110/// not have access to right-of-way rules.
111pub struct TrafficLight<'a> {
112    pub traffic_light: &'a maliput_sys::api::rules::ffi::TrafficLight,
113}
114
115impl<'a> TrafficLight<'a> {
116    /// Get the id of the [TrafficLight].
117    ///
118    /// # Returns
119    /// The id of the [TrafficLight].
120    pub fn id(&self) -> String {
121        maliput_sys::api::rules::ffi::TrafficLight_id(self.traffic_light)
122    }
123
124    /// Get the position of the [TrafficLight] in the road network.
125    ///
126    /// # Returns
127    /// An [super::InertialPosition] representing the position of the [TrafficLight] in the road network.
128    pub fn position_road_network(&self) -> super::InertialPosition {
129        let inertial_position = maliput_sys::api::rules::ffi::TrafficLight_position_road_network(self.traffic_light);
130        super::InertialPosition { ip: inertial_position }
131    }
132
133    /// Get the orientation of the [TrafficLight] in the road network.
134    ///
135    /// # Returns
136    /// An [super::Rotation] representing the orientation of the [TrafficLight] in the road network.
137    pub fn orientation_road_network(&self) -> super::Rotation {
138        let rotation = maliput_sys::api::rules::ffi::TrafficLight_orientation_road_network(self.traffic_light);
139        super::Rotation { r: rotation }
140    }
141
142    /// Get the bulb groups of the [TrafficLight].
143    ///
144    /// # Returns
145    /// A vector of [BulbGroup]s in the [TrafficLight].
146    /// If the [TrafficLight] has no bulb groups, return an empty vector.
147    pub fn bulb_groups(&self) -> Vec<BulbGroup<'_>> {
148        let bulb_groups_cpp = maliput_sys::api::rules::ffi::TrafficLight_bulb_groups(self.traffic_light);
149        bulb_groups_cpp
150            .into_iter()
151            .map(|bg| BulbGroup {
152                bulb_group: unsafe { bg.bulb_group.as_ref().expect("") },
153            })
154            .collect::<Vec<BulbGroup>>()
155    }
156
157    /// Get a [BulbGroup] by its id.
158    ///
159    /// # Arguments
160    /// * `id` - The id of the [BulbGroup].
161    ///
162    /// # Returns
163    /// The [BulbGroup] with the given id.
164    /// If no [BulbGroup] is found with the given id, return None.
165    pub fn get_bulb_group(&self, id: &String) -> Option<BulbGroup<'_>> {
166        let bulb_group = maliput_sys::api::rules::ffi::TrafficLight_GetBulbGroup(self.traffic_light, id);
167        if bulb_group.is_null() {
168            return None;
169        }
170        Some(BulbGroup {
171            bulb_group: unsafe {
172                bulb_group
173                    .as_ref()
174                    .expect("Unable to get underlying bulb group pointer")
175            },
176        })
177    }
178
179    /// Get the lane IDs that this traffic light is physically relevant to.
180    ///
181    /// # Returns
182    /// A vector of lane ID strings.
183    pub fn related_lanes(&self) -> Vec<String> {
184        maliput_sys::api::rules::ffi::TrafficLight_related_lanes(self.traffic_light)
185    }
186}
187
188#[derive(Debug, Copy, Clone, PartialEq, Eq)]
189/// Defines the possible bulb colors.
190pub enum BulbColor {
191    Red,
192    Yellow,
193    Green,
194}
195
196#[derive(Debug, Copy, Clone, PartialEq, Eq)]
197/// Defines the possible bulb types.
198pub enum BulbType {
199    Round,
200    /// Arrow with a custom orientation specified by [Bulb::arrow_orientation_rad].
201    Arrow,
202    /// Predefined arrow pointing left.
203    ArrowLeft,
204    /// Predefined arrow pointing right.
205    ArrowRight,
206    /// Predefined arrow pointing up (forward).
207    ArrowUp,
208    /// Predefined arrow pointing upper-left.
209    ArrowUpperLeft,
210    /// Predefined arrow pointing upper-right.
211    ArrowUpperRight,
212    /// U-turn to the left.
213    UTurnLeft,
214    /// U-turn to the right.
215    UTurnRight,
216    /// Pedestrian walk signal.
217    Walk,
218    /// Pedestrian don't walk signal.
219    DontWalk,
220}
221
222#[derive(Debug, Copy, Clone, PartialEq, Eq)]
223/// Defines the possible bulb states.
224pub enum BulbState {
225    Off,
226    On,
227    Blinking,
228    Counting,
229}
230
231/// Models a bulb within a bulb group.
232pub struct Bulb<'a> {
233    pub bulb: &'a maliput_sys::api::rules::ffi::Bulb,
234}
235
236impl Bulb<'_> {
237    /// Returns this Bulb instance's unique identifier.
238    ///
239    /// # Returns
240    /// A [UniqueBulbId] representing the unique identifier of the [Bulb].
241    pub fn unique_id(&self) -> UniqueBulbId {
242        UniqueBulbId {
243            unique_bulb_id: maliput_sys::api::rules::ffi::Bulb_unique_id(self.bulb),
244        }
245    }
246
247    /// Get the id of the [Bulb].
248    ///
249    /// # Returns
250    /// The id of the [Bulb].
251    pub fn id(&self) -> String {
252        maliput_sys::api::rules::ffi::Bulb_id(self.bulb)
253    }
254
255    /// Get the color of the [Bulb].
256    ///
257    /// # Returns
258    /// The [BulbColor].
259    pub fn color(&self) -> BulbColor {
260        let color = self.bulb.color();
261        match *color {
262            maliput_sys::api::rules::ffi::BulbColor::kRed => BulbColor::Red,
263            maliput_sys::api::rules::ffi::BulbColor::kYellow => BulbColor::Yellow,
264            maliput_sys::api::rules::ffi::BulbColor::kGreen => BulbColor::Green,
265            _ => panic!("Invalid bulb color"),
266        }
267    }
268
269    /// Get the type of the [Bulb].
270    ///
271    /// # Returns
272    /// The [BulbType].
273    pub fn bulb_type(&self) -> BulbType {
274        let bulb_type = maliput_sys::api::rules::ffi::Bulb_type(self.bulb);
275        match *bulb_type {
276            maliput_sys::api::rules::ffi::BulbType::kRound => BulbType::Round,
277            maliput_sys::api::rules::ffi::BulbType::kArrow => BulbType::Arrow,
278            maliput_sys::api::rules::ffi::BulbType::kArrowLeft => BulbType::ArrowLeft,
279            maliput_sys::api::rules::ffi::BulbType::kArrowRight => BulbType::ArrowRight,
280            maliput_sys::api::rules::ffi::BulbType::kArrowUp => BulbType::ArrowUp,
281            maliput_sys::api::rules::ffi::BulbType::kArrowUpperLeft => BulbType::ArrowUpperLeft,
282            maliput_sys::api::rules::ffi::BulbType::kArrowUpperRight => BulbType::ArrowUpperRight,
283            maliput_sys::api::rules::ffi::BulbType::kUTurnLeft => BulbType::UTurnLeft,
284            maliput_sys::api::rules::ffi::BulbType::kUTurnRight => BulbType::UTurnRight,
285            maliput_sys::api::rules::ffi::BulbType::kWalk => BulbType::Walk,
286            maliput_sys::api::rules::ffi::BulbType::kDontWalk => BulbType::DontWalk,
287            _ => panic!("Invalid bulb type"),
288        }
289    }
290
291    /// Get the position of the [Bulb] in the bulb group.
292    ///
293    /// # Returns
294    /// An [super::InertialPosition] representing the position of the [Bulb] in the bulb group.
295    pub fn position_bulb_group(&self) -> super::InertialPosition {
296        let inertial_position = maliput_sys::api::rules::ffi::Bulb_position_bulb_group(self.bulb);
297        super::InertialPosition { ip: inertial_position }
298    }
299
300    /// Get the orientation of the [Bulb] in the bulb group.
301    ///
302    /// # Returns
303    /// An [super::Rotation] representing the orientation of the [Bulb] in the bulb group.
304    pub fn orientation_bulb_group(&self) -> super::Rotation {
305        let rotation = maliput_sys::api::rules::ffi::Bulb_orientation_bulb_group(self.bulb);
306        super::Rotation { r: rotation }
307    }
308
309    /// Returns the arrow's orientation. Only applicable if [Bulb::bulb_type] returns [BulbType::Arrow].
310    ///
311    /// # Returns
312    /// An `Option<f64>` representing the orientation of the arrow in radians.
313    pub fn arrow_orientation_rad(&self) -> Option<f64> {
314        let arrow_orientation = maliput_sys::api::rules::ffi::Bulb_arrow_orientation_rad(self.bulb);
315        if arrow_orientation.is_null() {
316            return None;
317        }
318        Some(arrow_orientation.value)
319    }
320
321    /// Gets the possible states of the [Bulb].
322    ///
323    /// # Returns
324    /// A vector of [BulbState]s representing the possible states of the [Bulb].
325    pub fn states(&self) -> Vec<BulbState> {
326        let states_cpp = maliput_sys::api::rules::ffi::Bulb_states(self.bulb);
327        states_cpp
328            .into_iter()
329            .map(Bulb::_from_cpp_state_to_rust_state)
330            .collect::<Vec<BulbState>>()
331    }
332
333    /// Gets the default state of the [Bulb].
334    ///
335    /// # Returns
336    /// A [BulbState] representing the default state of the [Bulb].
337    pub fn get_default_state(&self) -> BulbState {
338        let default_state = self.bulb.GetDefaultState();
339        Bulb::_from_cpp_state_to_rust_state(&default_state)
340    }
341
342    /// Gets the initial state of the [Bulb].
343    ///
344    /// # Returns
345    /// A [BulbState] representing the initial state of the [Bulb].
346    pub fn get_initial_state(&self) -> BulbState {
347        let initial_state = self.bulb.GetInitialState();
348        Bulb::_from_cpp_state_to_rust_state(&initial_state)
349    }
350
351    /// Check if the given state is possible valid for the [Bulb].
352    ///
353    /// # Arguments
354    /// * `state` - The [BulbState] to check.
355    ///
356    /// # Returns
357    /// A boolean indicating whether the given state is valid for the [Bulb].
358    pub fn is_valid_state(&self, state: &BulbState) -> bool {
359        self.bulb.IsValidState(&Bulb::_from_rust_state_to_cpp_state(state))
360    }
361
362    /// Returns the bounding box of the bulb.
363    ///
364    /// # Returns
365    /// A tuple containing the minimum and maximum points of the bounding box.
366    pub fn bounding_box(&self) -> (crate::math::Vector3, crate::math::Vector3) {
367        let min = maliput_sys::api::rules::ffi::Bulb_bounding_box_min(self.bulb);
368        let max = maliput_sys::api::rules::ffi::Bulb_bounding_box_max(self.bulb);
369        (crate::math::Vector3 { v: min }, crate::math::Vector3 { v: max })
370    }
371
372    /// Returns the parent [BulbGroup] of the bulb.
373    ///
374    /// # Returns
375    /// The parent [BulbGroup] of the bulb.
376    /// If the bulb is not part of any group, return None.
377    pub fn bulb_group(&self) -> BulbGroup<'_> {
378        BulbGroup {
379            bulb_group: unsafe {
380                maliput_sys::api::rules::ffi::Bulb_bulb_group(self.bulb)
381                    .as_ref()
382                    .expect("Unable to get underlying bulb group pointer. The Bulb might not be part of any BulbGroup.")
383            },
384        }
385    }
386
387    /// Convert from the C++ BulbState to the Rust BulbState
388    /// It is expected to be used only internally.
389    ///
390    /// # Arguments
391    /// * `cpp_bulb_state` - The C++ BulbState
392    ///
393    /// # Returns
394    /// The Rust BulbState
395    ///
396    /// # Panics
397    /// If the C++ BulbState is invalid.
398    fn _from_cpp_state_to_rust_state(cpp_bulb_state: &maliput_sys::api::rules::ffi::BulbState) -> BulbState {
399        match *cpp_bulb_state {
400            maliput_sys::api::rules::ffi::BulbState::kOff => BulbState::Off,
401            maliput_sys::api::rules::ffi::BulbState::kOn => BulbState::On,
402            maliput_sys::api::rules::ffi::BulbState::kBlinking => BulbState::Blinking,
403            maliput_sys::api::rules::ffi::BulbState::kCounting => BulbState::Counting,
404            _ => panic!("Invalid bulb state"),
405        }
406    }
407
408    /// Convert from the Rust BulbState to the C++ BulbState
409    /// It is expected to be used only internally.
410    ///
411    /// # Arguments
412    /// * `rust_bulb_state` - The Rust BulbState
413    ///
414    /// # Returns
415    /// The C++ BulbState
416    fn _from_rust_state_to_cpp_state(rust_bulb_state: &BulbState) -> maliput_sys::api::rules::ffi::BulbState {
417        match rust_bulb_state {
418            BulbState::Off => maliput_sys::api::rules::ffi::BulbState::kOff,
419            BulbState::On => maliput_sys::api::rules::ffi::BulbState::kOn,
420            BulbState::Blinking => maliput_sys::api::rules::ffi::BulbState::kBlinking,
421            BulbState::Counting => maliput_sys::api::rules::ffi::BulbState::kCounting,
422        }
423    }
424}
425
426/// Models a group of bulbs within a traffic light. All of the bulbs within a
427/// group should share the same approximate orientation. However, this is not
428/// programmatically enforced.
429/// About the bulb group pose:
430/// - The position of the bulb group is defined as the linear offset of this bulb group's frame
431///   relative to the frame of the traffic light that contains it. The origin of
432///   this bulb group's frame should approximate the bulb group's CoM.
433/// - The orientation of the bulb group is defined as the rotational offset of this bulb
434///   group's frame relative to the frame of the traffic light that contains it.
435///   The +Z axis should align with the bulb group's "up" direction, and the +X
436///   axis should point in the direction that the bulb group is facing.
437///   Following a right-handed coordinate frame, the +Y axis should point left
438///   when facing the +X direction.
439pub struct BulbGroup<'a> {
440    pub bulb_group: &'a maliput_sys::api::rules::ffi::BulbGroup,
441}
442
443impl BulbGroup<'_> {
444    /// Returns this BulbGroup instance's unique identifier.
445    ///
446    /// # Returns
447    /// A [UniqueBulbGroupId] representing the unique identifier of the [BulbGroup].
448    pub fn unique_id(&self) -> UniqueBulbGroupId {
449        UniqueBulbGroupId {
450            unique_bulb_group_id: maliput_sys::api::rules::ffi::BulbGroup_unique_id(self.bulb_group),
451        }
452    }
453
454    /// Gets the id of the [BulbGroup].
455    ///
456    /// # Returns
457    /// The id of the [BulbGroup].
458    pub fn id(&self) -> String {
459        maliput_sys::api::rules::ffi::BulbGroup_id(self.bulb_group)
460    }
461
462    /// Gets the position of the [BulbGroup] in the traffic light.
463    ///
464    /// # Returns
465    /// An [super::InertialPosition] representing the position of the [BulbGroup] in the traffic light.
466    pub fn position_traffic_light(&self) -> super::InertialPosition {
467        let inertial_position = maliput_sys::api::rules::ffi::BulbGroup_position_traffic_light(self.bulb_group);
468        super::InertialPosition { ip: inertial_position }
469    }
470
471    /// Gets the orientation of the [BulbGroup] in the traffic light.
472    ///
473    /// # Returns
474    /// An [super::Rotation] representing the orientation of the [BulbGroup] in the traffic light.
475    pub fn orientation_traffic_light(&self) -> super::Rotation {
476        let rotation = maliput_sys::api::rules::ffi::BulbGroup_orientation_traffic_light(self.bulb_group);
477        super::Rotation { r: rotation }
478    }
479
480    /// Returns the bulbs in the bulb group.
481    ///
482    /// # Returns
483    /// A vector of [Bulb]s in the bulb group.
484    pub fn bulbs(&self) -> Vec<Bulb<'_>> {
485        let bulbs_cpp = maliput_sys::api::rules::ffi::BulbGroup_bulbs(self.bulb_group);
486        bulbs_cpp
487            .into_iter()
488            .map(|b| Bulb {
489                bulb: unsafe { b.bulb.as_ref().expect("") },
490            })
491            .collect::<Vec<Bulb>>()
492    }
493
494    /// Gets a [Bulb] by its id
495    ///
496    /// # Arguments
497    /// * `id` - The id of the [Bulb].
498    ///
499    /// # Returns
500    /// The [Bulb] with the given id.
501    /// If no [Bulb] is found with the given id, return None.
502    pub fn get_bulb(&self, id: &String) -> Option<Bulb<'_>> {
503        let bulb = maliput_sys::api::rules::ffi::BulbGroup_GetBulb(self.bulb_group, id);
504        if bulb.is_null() {
505            return None;
506        }
507        Some(Bulb {
508            bulb: unsafe { bulb.as_ref().expect("Unable to get underlying bulb pointer") },
509        })
510    }
511
512    /// Returns the parent [TrafficLight] of the bulb group.
513    ///
514    /// # Returns
515    /// The parent [TrafficLight] of the bulb group.
516    pub fn traffic_light(&self) -> TrafficLight<'_> {
517        TrafficLight {
518            traffic_light: unsafe {
519                maliput_sys::api::rules::ffi::BulbGroup_traffic_light(self.bulb_group)
520                    .as_ref()
521                    .expect("Unable to get underlying traffic light pointer. The BulbGroup might not be registered to a TrafficLight.")
522            },
523        }
524    }
525}
526
527/// Uniquely identifies a bulb in the `Inertial` space. This consists of the
528/// concatenation of the bulb's ID, the ID of the bulb group that contains the
529/// bulb, and the the ID of the traffic light that contains the bulb group.
530///
531/// String representation of this ID is:
532/// "`traffic_light_id().string()`-`bulb_group_id.string()`-`bulb_id.string()`"
533pub struct UniqueBulbId {
534    pub(crate) unique_bulb_id: cxx::UniquePtr<maliput_sys::api::rules::ffi::UniqueBulbId>,
535}
536
537impl UniqueBulbId {
538    /// Get the traffic light id of the [UniqueBulbId].
539    ///
540    /// # Returns
541    /// The traffic light id of the [UniqueBulbId].
542    pub fn traffic_light_id(&self) -> String {
543        maliput_sys::api::rules::ffi::UniqueBulbId_traffic_light_id(&self.unique_bulb_id)
544    }
545
546    /// Get the bulb group id of the [UniqueBulbId].
547    ///
548    /// # Returns
549    /// The bulb group id of the [UniqueBulbId].
550    pub fn bulb_group_id(&self) -> String {
551        maliput_sys::api::rules::ffi::UniqueBulbId_bulb_group_id(&self.unique_bulb_id)
552    }
553
554    /// Get the bulb id of the [UniqueBulbId].
555    ///
556    /// # Returns
557    /// The bulb id of the [UniqueBulbId].
558    pub fn bulb_id(&self) -> String {
559        maliput_sys::api::rules::ffi::UniqueBulbId_bulb_id(&self.unique_bulb_id)
560    }
561
562    /// Get the string representation of the [UniqueBulbId].
563    ///
564    /// # Returns
565    /// The string representation of the [UniqueBulbId].
566    pub fn string(&self) -> String {
567        self.unique_bulb_id.string().to_string()
568    }
569}
570
571/// Uniquely identifies a bulb group in the `Inertial` space. This consists of
572/// the concatenation of the ID of the bulb group, and the ID of the traffic
573/// light that contains the bulb group.
574///
575/// String representation of this ID is:
576/// "`traffic_light_id().string()`-`bulb_group_id.string()`"
577pub struct UniqueBulbGroupId {
578    unique_bulb_group_id: cxx::UniquePtr<maliput_sys::api::rules::ffi::UniqueBulbGroupId>,
579}
580
581impl UniqueBulbGroupId {
582    /// Get the traffic light id of the [UniqueBulbGroupId].
583    ///
584    /// # Returns
585    /// The traffic light id of the [UniqueBulbGroupId].
586    pub fn traffic_light_id(&self) -> String {
587        maliput_sys::api::rules::ffi::UniqueBulbGroupId_traffic_light_id(&self.unique_bulb_group_id)
588    }
589
590    /// Get the bulb group id of the [UniqueBulbGroupId].
591    ///
592    /// # Returns
593    /// The bulb group id of the [UniqueBulbGroupId].
594    pub fn bulb_group_id(&self) -> String {
595        maliput_sys::api::rules::ffi::UniqueBulbGroupId_bulb_group_id(&self.unique_bulb_group_id)
596    }
597
598    /// Get the string representation of the [UniqueBulbGroupId].
599    ///
600    /// # Returns
601    /// The string representation of the [UniqueBulbGroupId].
602    pub fn string(&self) -> String {
603        self.unique_bulb_group_id.string().to_string()
604    }
605}
606
607/// Interface for querying types of rules. It includes both Discrete and Range value rules. It
608/// provides a registry of the various rule types.
609pub struct RuleRegistry<'a> {
610    pub(super) rule_registry: &'a maliput_sys::api::rules::ffi::RuleRegistry,
611}
612
613/// Represents the rule values the [RuleRegistry] can contain by their Discrete or Range type.
614pub enum RuleValuesByType {
615    DiscreteValues(Vec<DiscreteValue>),
616    Ranges(Vec<Range>),
617}
618
619impl<'a> RuleRegistry<'a> {
620    /// Returns all [DiscreteValue] rule type IDs.
621    ///
622    /// # Returns
623    /// A vector of [String]s representing rule type IDs that correspond to different
624    /// [DiscreteValue]s in the [RuleRegistry].
625    pub fn get_discrete_value_rule_types(&self) -> Vec<String> {
626        let discrete_value_types =
627            maliput_sys::api::rules::ffi::RuleRegistry_DiscreteValueRuleTypes(self.rule_registry);
628        let discrete_value_types = discrete_value_types
629            .as_ref()
630            .expect("Unable to get underlying discrete value rule types pointer.");
631        discrete_value_types.iter().map(|dvt| dvt.type_id.clone()).collect()
632    }
633
634    /// Returns all [DiscreteValue]s corresponding to the specified `rule_type_id`.
635    ///
636    /// This methods works in tandem with [RuleRegistry::get_discrete_value_rule_types].
637    ///
638    /// # Arguments
639    /// * `rule_type_id` - The id of the rule type.
640    ///
641    /// # Returns
642    /// A vector of [DiscreteValue]s or [None] if the `rule_type_id` doesn't match any type id in
643    /// the [RuleRegistry].
644    pub fn discrete_values_by_type(&self, rule_type_id: String) -> Option<Vec<DiscreteValue>> {
645        let discrete_value_types =
646            maliput_sys::api::rules::ffi::RuleRegistry_DiscreteValueRuleTypes(self.rule_registry);
647        let discrete_value_types = discrete_value_types
648            .as_ref()
649            .expect("Unable to get underlying discrete value rule types pointer.");
650        discrete_value_types
651            .iter()
652            .find(|dvt| dvt.type_id == rule_type_id)
653            .map(|dvt| discrete_values_from_cxx(&dvt.values))
654    }
655
656    /// Returns all [Range] rule type IDs.
657    ///
658    /// # Returns
659    /// A vector of [String]s representing rule type IDs that correspond to different [Range]s in
660    /// the [RuleRegistry].
661    pub fn get_range_rule_types(&self) -> Vec<String> {
662        let range_value_types = maliput_sys::api::rules::ffi::RuleRegistry_RangeValueRuleTypes(self.rule_registry);
663        let range_value_types = range_value_types
664            .as_ref()
665            .expect("Unable to get underlying range rule types pointer.");
666        range_value_types.iter().map(|rvt| rvt.type_id.clone()).collect()
667    }
668
669    /// Returns all [Range]s corresponding to the specified `rule_type_id`.
670    ///
671    /// This methods works in tandem with [RuleRegistry::get_range_rule_types].
672    ///
673    /// # Arguments
674    /// * `rule_type_id` - The id of the rule type.
675    ///
676    /// # Returns
677    /// A vector of [Range]s or [None] if the `rule_type_id` doesn't match any type id in the
678    /// [RuleRegistry].
679    pub fn range_values_by_type(&self, rule_type_id: String) -> Option<Vec<Range>> {
680        let range_value_types = maliput_sys::api::rules::ffi::RuleRegistry_RangeValueRuleTypes(self.rule_registry);
681        let range_value_types = range_value_types
682            .as_ref()
683            .expect("Unable to get underlying range rule types pointer.");
684        range_value_types
685            .iter()
686            .find(|rvt| rvt.type_id == rule_type_id)
687            .map(|rvt| range_values_from_cxx(&rvt.values))
688    }
689
690    /// Returns all possible states for a given `rule_type_id`.
691    ///
692    /// # Arguments
693    /// * `rule_type_id` - The id of the rule type.
694    ///
695    /// # Returns
696    /// An `Option` containing a [RuleValuesByType] enum with either a vector of [Range]s or a
697    /// vector of [DiscreteValue]s. Returns `None` if the `rule_type_id` is not found.
698    pub fn get_possible_states_of_rule_type(&self, rule_type_id: String) -> Option<RuleValuesByType> {
699        if let Some(ranges) = self.range_values_by_type(rule_type_id.clone()) {
700            Some(RuleValuesByType::Ranges(ranges))
701        } else {
702            self.discrete_values_by_type(rule_type_id)
703                .map(RuleValuesByType::DiscreteValues)
704        }
705    }
706}
707
708/// Abstraction for holding the output of [RoadRulebook::rules()] and [RoadRulebook::find_rules()]
709/// methods.
710/// This struct contains a map of [DiscreteValueRule]s and [RangeValueRule]s.
711/// The keys of the map are the ids of the rules.
712/// The values of the map are the rules.
713pub struct QueryResults {
714    pub discrete_value_rules: std::collections::HashMap<String, DiscreteValueRule>,
715    pub range_value_rules: std::collections::HashMap<String, RangeValueRule>,
716}
717
718/// Interface for querying "rules of the road". This interface
719/// provides access to static information about a road network (i.e.,
720/// information determined prior to the beginning of a simulation). Some
721/// rule types may refer to additional dynamic information which will be
722/// provided by other interfaces.
723pub struct RoadRulebook<'a> {
724    pub(super) road_rulebook: &'a maliput_sys::api::rules::ffi::RoadRulebook,
725}
726
727impl<'a> RoadRulebook<'a> {
728    /// Returns the DiscreteValueRule with the specified `id`.
729    ///
730    /// # Arguments
731    /// * `rule_id` - The id of the rule.
732    ///
733    /// # Returns
734    /// The DiscreteValueRule with the given id or None if the id is not in the Rulebook.
735    pub fn get_discrete_value_rule(&self, rule_id: &String) -> Option<DiscreteValueRule> {
736        let discrete_value_rule =
737            maliput_sys::api::rules::ffi::RoadRulebook_GetDiscreteValueRule(self.road_rulebook, rule_id);
738        if discrete_value_rule.is_null() {
739            return None;
740        }
741        Some(DiscreteValueRule { discrete_value_rule })
742    }
743    /// Returns the RangeValueRule with the specified `id`.
744    ///
745    /// # Arguments
746    /// * `rule_id` - The id of the rule.
747    ///
748    /// # Returns
749    /// The RangeValueRule with the given id or None if the id is not in the Rulebook.
750    pub fn get_range_value_rule(&self, rule_id: &String) -> Option<RangeValueRule> {
751        let range_value_rule =
752            maliput_sys::api::rules::ffi::RoadRulebook_GetRangeValueRule(self.road_rulebook, rule_id);
753        if range_value_rule.is_null() {
754            return None;
755        }
756        Some(RangeValueRule { range_value_rule })
757    }
758
759    /// Returns all the rules in the road rulebook.
760    ///
761    /// # Returns
762    /// A [QueryResults] containing all the rules in the road rulebook.
763    pub fn rules(&self) -> QueryResults {
764        let query_results_cpp = maliput_sys::api::rules::ffi::RoadRulebook_Rules(self.road_rulebook);
765        let discrete_value_rules_id =
766            maliput_sys::api::rules::ffi::QueryResults_discrete_value_rules(&query_results_cpp);
767        let range_value_rules_id = maliput_sys::api::rules::ffi::QueryResults_range_value_rules(&query_results_cpp);
768        let mut dvr_map = std::collections::HashMap::new();
769        for rule_id in discrete_value_rules_id {
770            // It is okay to unwrap here since we are iterating valid IDs obtained above.
771            let rule = self.get_discrete_value_rule(&rule_id).unwrap();
772            dvr_map.insert(rule.id(), rule);
773        }
774        let mut rvr_map = std::collections::HashMap::new();
775        for rule_id in range_value_rules_id {
776            // It is okay to unwrap here since we are iterating valid IDs obtained above.
777            let rule = self.get_range_value_rule(&rule_id).unwrap();
778            rvr_map.insert(rule.id(), rule);
779        }
780        QueryResults {
781            discrete_value_rules: dvr_map,
782            range_value_rules: rvr_map,
783        }
784    }
785
786    /// Finds rules that apply to the given lane s ranges.
787    ///
788    /// # Arguments
789    /// * `ranges` - A vector of [super::LaneSRange]s to find rules for.
790    /// * `tolerance` - A tolerance value to use when finding rules.
791    ///
792    /// # Returns
793    /// A [QueryResults] containing the rules that apply to the given lane s ranges.
794    /// If no rules are found, an empty [QueryResults] is returned.
795    ///
796    /// # Errors
797    /// Returns a [MaliputError] if the underlying C++ function fails.
798    pub fn find_rules(&self, ranges: &Vec<super::LaneSRange>, tolerance: f64) -> Result<QueryResults, MaliputError> {
799        let mut ranges_cpp = Vec::new();
800        for range in ranges {
801            ranges_cpp.push(maliput_sys::api::rules::ffi::ConstLaneSRangeRef {
802                lane_s_range: &range.lane_s_range,
803            });
804        }
805        let query_results_cpp =
806            maliput_sys::api::rules::ffi::RoadRulebook_FindRules(self.road_rulebook, &ranges_cpp, tolerance)?;
807
808        let discrete_value_rules_id =
809            maliput_sys::api::rules::ffi::QueryResults_discrete_value_rules(&query_results_cpp);
810        let range_value_rules_id = maliput_sys::api::rules::ffi::QueryResults_range_value_rules(&query_results_cpp);
811        let mut dvr_map = std::collections::HashMap::new();
812        for rule_id in discrete_value_rules_id {
813            if let Some(rule) = self.get_discrete_value_rule(&rule_id) {
814                dvr_map.insert(rule.id(), rule);
815            }
816        }
817        let mut rvr_map = std::collections::HashMap::new();
818        for rule_id in range_value_rules_id {
819            if let Some(rule) = self.get_range_value_rule(&rule_id) {
820                rvr_map.insert(rule.id(), rule);
821            }
822        }
823        Ok(QueryResults {
824            discrete_value_rules: dvr_map,
825            range_value_rules: rvr_map,
826        })
827    }
828}
829
830/// # Rule
831///
832/// A Rule may have multiple states that affect agent behavior while it is
833/// driving through the rule's zone. The possible states of a Rule must be
834/// semantically coherent. The current state of a Rule is given by a
835/// [RuleStateProvider]. States can be:
836///
837/// - range based ([RangeValueRule]).
838/// - discrete ([DiscreteValueRule]).
839///
840/// # DiscreteValueRule
841///
842/// [DiscreteValue]s are defined by a string value.
843/// Semantics of this rule are based on _all_ possible values that this
844/// [DiscreteValueRule::type_id] could have (as specified by RuleRegistry::FindRuleByType()),
845/// not only the subset of values that a specific instance of this rule can
846/// be in.
847pub struct DiscreteValueRule {
848    discrete_value_rule: cxx::UniquePtr<maliput_sys::api::rules::ffi::DiscreteValueRule>,
849}
850
851impl DiscreteValueRule {
852    /// Returns the Id of the rule as a string.
853    ///
854    /// # Returns
855    /// The id of the rule.
856    pub fn id(&self) -> String {
857        maliput_sys::api::rules::ffi::DiscreteValueRule_id(&self.discrete_value_rule)
858    }
859    /// Returns the type of the rule as a string.
860    /// Example: "right-of-way-rule-type-id", "direction-usage-rule-type-id"
861    ///
862    /// # Returns
863    /// The type id of the rule.
864    pub fn type_id(&self) -> String {
865        maliput_sys::api::rules::ffi::DiscreteValueRule_type_id(&self.discrete_value_rule)
866    }
867    /// Returns a [super::LaneSRoute] that represents the zone that the rule applies to.
868    ///
869    /// # Returns
870    /// A [super::LaneSRoute] representing the zone of the rule.
871    pub fn zone(&self) -> super::LaneSRoute {
872        let lane_s_route = maliput_sys::api::rules::ffi::DiscreteValueRule_zone(&self.discrete_value_rule);
873        super::LaneSRoute { lane_s_route }
874    }
875    /// Returns the states of the rule.
876    ///
877    /// # Returns
878    /// A vector of [DiscreteValue]s representing the states of the rule.
879    /// If the rule has no states, an empty vector is returned.
880    pub fn states(&self) -> Vec<DiscreteValue> {
881        discrete_values_from_cxx(self.discrete_value_rule.states())
882    }
883}
884
885impl std::fmt::Debug for DiscreteValueRule {
886    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
887        write!(
888            f,
889            "DiscreteValueRule {{ id: {}, type_id: {}, zone: {:?}, states: {:?} }}",
890            self.id(),
891            self.type_id(),
892            self.zone(),
893            self.states()
894        )
895    }
896}
897
898/// Holds a `Rule` ID and the current state of that `Rule`.
899/// It is usually used as a return type for [super::Intersection::discrete_value_rule_states].
900pub struct DiscreteValueRuleState {
901    /// Rule ID.
902    pub rule_id: String,
903    /// Current state of the rule.
904    pub state: DiscreteValue,
905}
906
907/// # Rule
908///
909/// A Rule may have multiple states that affect agent behavior while it is
910/// driving through the rule's zone. The possible states of a Rule must be
911/// semantically coherent. The current state of a Rule is given by a
912/// [RuleStateProvider]. States can be:
913///
914/// - range based ([RangeValueRule]).
915/// - discrete ([DiscreteValueRule]).
916///
917/// # RangeValueRule
918///
919/// [Range]s describe a numeric range based rule.
920/// Ranges are closed and continuous, defined by a minimum and maximum quantity.
921/// When only one extreme is formally defined, the other should take a
922/// semantically correct value. For example, if a speed limit only specifies a
923/// maximum value, the minimum value is typically zero.
924pub struct RangeValueRule {
925    range_value_rule: cxx::UniquePtr<maliput_sys::api::rules::ffi::RangeValueRule>,
926}
927
928impl RangeValueRule {
929    /// Returns the Id of the rule as a string.
930    ///
931    /// # Returns
932    /// The id of the rule.
933    pub fn id(&self) -> String {
934        maliput_sys::api::rules::ffi::RangeValueRule_id(&self.range_value_rule)
935    }
936    /// Returns the type of the rule as a string.
937    /// Example: "right-of-way-rule-type-id", "direction-usage-rule-type-id"
938    ///
939    /// # Returns
940    /// The type id of the rule.
941    pub fn type_id(&self) -> String {
942        maliput_sys::api::rules::ffi::RangeValueRule_type_id(&self.range_value_rule)
943    }
944    /// Returns a [super::LaneSRoute] that represents the zone that the rule applies to.
945    ///
946    /// # Returns
947    /// A [super::LaneSRoute] representing the zone of the rule.
948    pub fn zone(&self) -> super::LaneSRoute {
949        let lane_s_route = maliput_sys::api::rules::ffi::RangeValueRule_zone(&self.range_value_rule);
950        super::LaneSRoute { lane_s_route }
951    }
952    /// Returns the states of the rule.
953    ///
954    /// # Returns
955    /// A vector of [Range]s representing the states of the rule.
956    /// If the rule has no states, an empty vector is returned.
957    pub fn states(&self) -> Vec<Range> {
958        range_values_from_cxx(self.range_value_rule.states())
959    }
960}
961
962/// Defines a Rule Type.
963///
964/// # RuleType
965///
966/// [RuleType]s provide a way of obtaining a rule type's string defined in
967/// maliput's backend. Since new rule types can be created in a custom manner,
968/// [RuleType] only holds the most common types which are already defined in
969/// the backend.
970#[derive(Display, IntoStaticStr)]
971pub enum RuleType {
972    #[strum(serialize = "Direction-Usage Rule Type")]
973    DirectionUsage,
974    #[strum(serialize = "Right-Of-Way Rule Type")]
975    RightOfWay,
976    #[strum(serialize = "Vehicle-Stop-In-Zone-Behavior Rule Type")]
977    VehicleStopInZoneBehavior,
978    #[strum(serialize = "Speed-Limit Rule Type")]
979    SpeedLimit,
980}
981
982impl RuleType {
983    /// Gets the Rule ID for the [RuleType] and `lane_id`.
984    ///
985    /// # Arguments
986    /// - `lane_id` - The lane ID to get the rule ID from.
987    ///
988    /// # Returns
989    /// A rule ID formatted the way the backend defines it.
990    pub fn get_rule_id(&self, lane_id: &str) -> String {
991        // We rely on maliput_malidrive which define the rule id as:
992        // "<rule_type>/<lane_id>"
993        self.to_string() + "/" + lane_id
994    }
995}
996
997/// Defines a base state for a rule.
998///
999/// # RuleStateBase
1000///
1001/// - `severity` - The severity of the rule state.
1002/// - `related_rules` - A map of related rules. The key is the group name and the value is a vector of rule ids.
1003/// - `related_unique_ids` - A map of related unique ids. The key is the group name and the value is a vector of unique ids.
1004///
1005/// See [DiscreteValueRule] and [RangeValueRule] for more information.
1006pub struct RuleStateBase {
1007    /// Severity of the rule's state. A non-negative quantity that specifies the
1008    /// level of enforcement. The smaller it is, the more strictly the rule is
1009    /// enforced. Each rule type can define its own set of severity level
1010    /// semantics.
1011    severity: i32,
1012    related_rules: cxx::UniquePtr<cxx::CxxVector<maliput_sys::api::rules::ffi::RelatedRule>>,
1013    related_unique_ids: cxx::UniquePtr<cxx::CxxVector<maliput_sys::api::rules::ffi::RelatedUniqueId>>,
1014}
1015
1016/// A trait representing a possible state of a `Rule`.
1017///
1018/// A `Rule` can have multiple states that affect agent behavior. This trait
1019/// provides a common interface for accessing the properties shared by all
1020/// rule states, such as severity and related rules.
1021///
1022/// This trait is implemented by specific state types like [`DiscreteValue`]
1023/// and [`Range`].
1024///
1025/// # Implementors
1026///
1027/// When implementing this trait, you must provide an implementation for the
1028/// [`get_rule_state()`] method, which gives access to the underlying
1029/// [`RuleStateBase`] data. The other methods have default implementations.
1030pub trait RuleState {
1031    /// Gets the underlying [`RuleStateBase`] that contains common state properties.
1032    ///
1033    /// # Returns
1034    /// A reference to the [`RuleStateBase`] that contains the severity, related rules,
1035    /// and related unique ids for the rule state.
1036    fn get_rule_state(&self) -> &RuleStateBase;
1037
1038    /// Returns the severity of the rule state.
1039    ///
1040    /// # Returns
1041    /// An `i32` representing the severity of the rule state.
1042    /// The severity is a numeric value that indicates the importance or urgency of the rule. The lower the value, the more strictly the rule is enforced.
1043    fn severity(&self) -> i32 {
1044        self.get_rule_state().severity
1045    }
1046
1047    /// Returns a map of related rules ids. The key is the group name and the value is a vector of rule ids.
1048    ///
1049    /// # Returns
1050    /// A map of related rules where the key is the group name and the value is a vector of rule ids.
1051    fn related_rules(&self) -> std::collections::HashMap<&String, &Vec<String>> {
1052        self.get_rule_state()
1053            .related_rules
1054            .iter()
1055            .map(|rr| (&rr.group_name, &rr.rule_ids))
1056            .collect::<std::collections::HashMap<&String, &Vec<String>>>()
1057    }
1058    /// Returns a map of related unique ids. The key is the group name and the value is a vector of unique ids.
1059    ///
1060    /// # Returns
1061    /// A map of related unique ids where the key is the group name and the value is a vector of unique ids.
1062    fn related_unique_ids(&self) -> std::collections::HashMap<&String, &Vec<String>> {
1063        self.get_rule_state()
1064            .related_unique_ids
1065            .iter()
1066            .map(|rui| (&rui.group_name, &rui.unique_ids))
1067            .collect::<std::collections::HashMap<&String, &Vec<String>>>()
1068    }
1069}
1070
1071/// Defines a discrete value for a [DiscreteValueRule].
1072/// It extends the [RuleStateBase] with the value of the discrete value.
1073pub struct DiscreteValue {
1074    rule_state: RuleStateBase,
1075    value: String,
1076}
1077
1078impl RuleState for DiscreteValue {
1079    fn get_rule_state(&self) -> &RuleStateBase {
1080        &self.rule_state
1081    }
1082}
1083
1084impl DiscreteValue {
1085    /// Returns the value of the discrete value.
1086    pub fn value(&self) -> &String {
1087        &self.value
1088    }
1089}
1090
1091impl std::fmt::Debug for DiscreteValue {
1092    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1093        write!(
1094            f,
1095            "DiscreteValue {{ value: {}, severity: {}, related_rules: {:?}, related_unique_ids: {:?} }}",
1096            self.value(),
1097            self.severity(),
1098            self.related_rules(),
1099            self.related_unique_ids()
1100        )
1101    }
1102}
1103
1104/// Defines a range value for a [RangeValueRule].
1105/// It extends the [RuleStateBase] with the description, and min and max values of the range.
1106pub struct Range {
1107    rule_state: RuleStateBase,
1108    description: String,
1109    min: f64,
1110    max: f64,
1111}
1112
1113impl RuleState for Range {
1114    fn get_rule_state(&self) -> &RuleStateBase {
1115        &self.rule_state
1116    }
1117}
1118
1119impl Range {
1120    /// Returns the description of the range value.
1121    pub fn description(&self) -> &String {
1122        &self.description
1123    }
1124    /// Returns the minimum value of the range.
1125    pub fn min(&self) -> f64 {
1126        self.min
1127    }
1128    /// Returns the maximum value of the range.
1129    pub fn max(&self) -> f64 {
1130        self.max
1131    }
1132}
1133
1134/// Defines a phase in a traffic rule system.
1135///
1136/// A phase represents a specific state or configuration of traffic signals
1137/// and semantic rules within a traffic control system. Each phase has a unique
1138/// identifier and may include various traffic signal states and rule configurations
1139/// that dictate how traffic should behave during that phase.
1140pub struct Phase {
1141    phase: cxx::UniquePtr<maliput_sys::api::rules::ffi::Phase>,
1142}
1143
1144impl Phase {
1145    /// Gets the id of the [Phase].
1146    ///
1147    /// # Returns
1148    /// The id of the [Phase].
1149    pub fn id(&self) -> String {
1150        maliput_sys::api::rules::ffi::Phase_id(&self.phase)
1151    }
1152
1153    /// Gets the states of all discrete value rules for this phase.
1154    ///
1155    /// # Returns
1156    /// A `HashMap` where the key is the rule ID as a [String] and the value is the
1157    /// [DiscreteValue] state of that rule.
1158    pub fn discrete_value_rule_states(&self) -> HashMap<String, DiscreteValue> {
1159        let rule_states = maliput_sys::api::rules::ffi::Phase_discrete_value_rule_states(&self.phase);
1160        rule_states
1161            .iter()
1162            .map(|state| {
1163                (
1164                    state.rule_id.clone(),
1165                    discrete_value_from_discrete_value_cxx(&state.state),
1166                )
1167            })
1168            .collect()
1169    }
1170
1171    /// Obtains all [UniqueBulbId]s in the [Phase].
1172    ///
1173    /// # Returns
1174    /// A vector of [UniqueBulbId].
1175    pub fn unique_bulb_ids(&self) -> Vec<UniqueBulbId> {
1176        let unique_bulb_ids = maliput_sys::api::rules::ffi::Phase_unique_bulb_ids(&self.phase);
1177        unique_bulb_ids
1178            .iter()
1179            .map(|bulb_id| UniqueBulbId {
1180                unique_bulb_id: maliput_sys::api::rules::ffi::ptr_from_unique_bulb_id(bulb_id),
1181            })
1182            .collect()
1183    }
1184
1185    /// Returns the [BulbState] corresponding to a `bulb_id`.
1186    ///
1187    /// # Arguments
1188    /// * `unique_bulb_id` - The [UniqueBulbId] to get the [BulbState] from.
1189    ///
1190    /// # Returns
1191    /// The [BulbState] the `unique_bulb_id` is in, or [None] if the [UniqueBulbId] is not in this [Phase].
1192    pub fn bulb_state(&self, unique_bulb_id: &UniqueBulbId) -> Option<BulbState> {
1193        let bulb_state = maliput_sys::api::rules::ffi::Phase_bulb_state(&self.phase, &unique_bulb_id.unique_bulb_id);
1194        if bulb_state.is_null() {
1195            return None;
1196        }
1197        Some(match *bulb_state {
1198            maliput_sys::api::rules::ffi::BulbState::kOff => BulbState::Off,
1199            maliput_sys::api::rules::ffi::BulbState::kOn => BulbState::On,
1200            maliput_sys::api::rules::ffi::BulbState::kBlinking => BulbState::Blinking,
1201            maliput_sys::api::rules::ffi::BulbState::kCounting => BulbState::Counting,
1202            _ => return None,
1203        })
1204    }
1205}
1206
1207/// Defines a phase that comes after another [Phase].
1208/// Used as a return type by:
1209///   - [PhaseRing::get_next_phases].
1210pub struct NextPhase {
1211    /// The next phase.
1212    pub next_phase: Phase,
1213    /// The default time before transitioning to the next phase. This is
1214    /// relative to when the current phase began. It is just a recommendation,
1215    /// the actual duration is determined by the PhaseProvider and may depend on
1216    /// events like a vehicle arriving at a left-turn lane or a pedestrian
1217    /// hitting a crosswalk button.
1218    pub duration_until: Option<f64>,
1219}
1220
1221/// Defines a ring of phases in a traffic rule system.
1222///
1223/// A phase ring represents a sequence of phases that a traffic control system
1224/// cycles through.
1225pub struct PhaseRing {
1226    phase_ring: cxx::UniquePtr<maliput_sys::api::rules::ffi::PhaseRing>,
1227}
1228
1229impl PhaseRing {
1230    /// Gets the id of the [PhaseRing].
1231    ///
1232    /// # Returns
1233    /// The id of the [PhaseRing].
1234    pub fn id(&self) -> String {
1235        maliput_sys::api::rules::ffi::PhaseRing_id(&self.phase_ring)
1236    }
1237
1238    /// Gets a [Phase] by its id
1239    ///
1240    /// # Arguments
1241    /// * `id` - The id of the [Phase].
1242    /// # Returns
1243    /// The [Phase] with the given id.
1244    /// If no [Phase] is found with the given id, return None.
1245    pub fn get_phase(&self, id: &String) -> Option<Phase> {
1246        let phase = maliput_sys::api::rules::ffi::PhaseRing_GetPhase(&self.phase_ring, id);
1247        if phase.is_null() {
1248            return None;
1249        }
1250        Some(Phase { phase })
1251    }
1252
1253    /// Returns the ids of all Phases in the PhaseRing.
1254    ///
1255    /// # Returns
1256    /// A vector of strings representing the ids of all Phases in the PhaseRing.
1257    pub fn phases(&self) -> Vec<String> {
1258        maliput_sys::api::rules::ffi::PhaseRing_phases_ids(&self.phase_ring)
1259    }
1260
1261    /// Returns the next phases for a given phase `id`.
1262    ///
1263    /// # Arguments
1264    /// * `id` - The id of the phase to get the next phases from.
1265    ///
1266    /// # Returns
1267    /// A `Result` containing a vector of [NextPhase]s.
1268    ///
1269    /// # Errors
1270    /// Returns a [MaliputError] if the provided `id` is not found in the [PhaseRing].
1271    pub fn get_next_phases(&self, id: &String) -> Result<Vec<NextPhase>, MaliputError> {
1272        let next_phases = maliput_sys::api::rules::ffi::PhaseRing_GetNextPhases(&self.phase_ring, id)?;
1273        Ok(next_phases
1274            .iter()
1275            .map(|np| NextPhase {
1276                next_phase: Phase {
1277                    phase: maliput_sys::api::rules::ffi::PhaseRing_GetPhase(&self.phase_ring, &np.phase_id),
1278                },
1279                duration_until: if np.duration_until.is_null() {
1280                    None
1281                } else {
1282                    Some(np.duration_until.value)
1283                },
1284            })
1285            .collect())
1286    }
1287}
1288
1289/// Defines a book of phase rings in a traffic rule system.
1290pub struct PhaseRingBook<'a> {
1291    pub(super) phase_ring_book: &'a maliput_sys::api::rules::ffi::PhaseRingBook,
1292}
1293
1294impl<'a> PhaseRingBook<'a> {
1295    /// Returns the ids of all PhaseRings in the PhaseRingBook.
1296    ///
1297    /// # Returns
1298    /// A vector of strings representing the ids of all PhaseRings in the PhaseRingBook.
1299    pub fn get_phase_rings_ids(&self) -> Vec<String> {
1300        maliput_sys::api::rules::ffi::PhaseRingBook_GetPhaseRingsId(self.phase_ring_book)
1301    }
1302
1303    /// Returns the PhaseRing with the specified `id`.
1304    ///
1305    /// # Arguments
1306    /// * `phase_ring_id` - The id of the phase ring.
1307    ///
1308    /// # Returns
1309    /// The PhaseRing with the given id or None if the id is not in the PhaseRingBook.
1310    pub fn get_phase_ring(&self, phase_ring_id: &String) -> Option<PhaseRing> {
1311        let phase_ring = maliput_sys::api::rules::ffi::PhaseRingBook_GetPhaseRing(self.phase_ring_book, phase_ring_id);
1312        if phase_ring.is_null() {
1313            return None;
1314        }
1315        Some(PhaseRing { phase_ring })
1316    }
1317
1318    /// Finds the [PhaseRing] that contains the rule with the specified `rule_id`.
1319    ///
1320    /// # Arguments
1321    /// * `rule_id` - The id of the rule.
1322    ///
1323    /// # Returns
1324    /// The [PhaseRing] that contains the rule with the given id or `None` if no [PhaseRing] is found.
1325    pub fn find_phase_ring(&self, rule_id: &String) -> Option<PhaseRing> {
1326        let phase_ring = maliput_sys::api::rules::ffi::PhaseRingBook_FindPhaseRing(self.phase_ring_book, rule_id);
1327        if phase_ring.is_null() {
1328            return None;
1329        }
1330        Some(PhaseRing { phase_ring })
1331    }
1332}
1333
1334/// Defines a next state of a generic type.
1335pub struct NextState<T> {
1336    /// The next state.
1337    pub next_state: T,
1338    /// The default time before transitioning to the next state. This is
1339    /// relative to when the current state began. It is just a recommendation,
1340    /// the actual duration is determined by the StateProvider and may depend on
1341    /// events like a vehicle arriving at a left-turn lane or a pedestrian
1342    /// hitting a crosswalk button.
1343    pub duration_until: Option<f64>,
1344}
1345
1346/// Holds the current and possible next state of a system.
1347/// It is usually returned by the different types of state providers.
1348pub struct StateProviderQuery<T> {
1349    /// The current state.
1350    pub state: T,
1351    /// The next state.
1352    pub next: Option<NextState<T>>,
1353}
1354
1355/// Alias for the [StateProviderQuery] returned by [PhaseProvider::get_phase].
1356pub type PhaseStateProviderQuery = StateProviderQuery<String>;
1357
1358/// Defines a phase provider.
1359///
1360/// A phase provider is able to get the current phase from a phase-based system.
1361pub struct PhaseProvider<'a> {
1362    pub(super) phase_provider: &'a maliput_sys::api::rules::ffi::PhaseProvider,
1363}
1364
1365impl<'a> PhaseProvider<'a> {
1366    /// Returns the [PhaseStateProviderQuery] for the specified `phase_ring_id`.
1367    ///
1368    /// The states are represented with Strings containing the IDs of each [Phase].
1369    ///
1370    /// # Arguments
1371    /// * `phase_ring_id` - The id of the phase ring.
1372    ///
1373    /// # Returns
1374    /// An `Option` containing the [PhaseStateProviderQuery] for the given `phase_ring_id`.
1375    /// Returns `None` if no phase provider is found for the given id.
1376    pub fn get_phase(&self, phase_ring_id: &String) -> Option<PhaseStateProviderQuery> {
1377        let phase_state = maliput_sys::api::rules::ffi::PhaseProvider_GetPhase(self.phase_provider, phase_ring_id);
1378        if phase_state.is_null() {
1379            return None;
1380        }
1381
1382        let next_state = maliput_sys::api::rules::ffi::PhaseStateProvider_next(&phase_state);
1383        let next_phase = if next_state.is_null() {
1384            None
1385        } else {
1386            Some(NextState {
1387                next_state: next_state.phase_id.clone(),
1388                duration_until: if next_state.duration_until.is_null() {
1389                    None
1390                } else {
1391                    Some(next_state.duration_until.value)
1392                },
1393            })
1394        };
1395
1396        Some(StateProviderQuery {
1397            state: maliput_sys::api::rules::ffi::PhaseStateProvider_state(&phase_state),
1398            next: next_phase,
1399        })
1400    }
1401}
1402
1403/// Provides the dynamic state of [DiscreteValueRule]s.
1404///
1405/// While a [RoadRulebook] provides the static definitions of rules, a
1406/// `DiscreteValueRuleStateProvider` provides the current state of those rules
1407/// at runtime. This allows for querying what state a rule is currently in,
1408/// which is essential for dynamic systems where rule states can change over
1409/// time (e.g., traffic light phases changing).
1410pub struct DiscreteValueRuleStateProvider<'a> {
1411    pub(super) state_provider: &'a maliput_sys::api::rules::ffi::DiscreteValueRuleStateProvider,
1412}
1413
1414impl<'a> DiscreteValueRuleStateProvider<'a> {
1415    /// Gets a state from the provider based on it's `rule_id`.
1416    ///
1417    /// # Arguments
1418    /// * `rule_id` - A Rule ID.
1419    ///
1420    /// # Returns
1421    /// An Option containing the [StateProviderQuery] with a [DiscreteValue] if the `rule_id` matches with any rule.
1422    /// Otherwise, None is returned.
1423    pub fn get_state_by_rule_id(&self, rule_id: &String) -> Option<StateProviderQuery<DiscreteValue>> {
1424        let query_state =
1425            maliput_sys::api::rules::ffi::DiscreteValueRuleStateProvider_GetStateById(self.state_provider, rule_id);
1426        Self::next_state_from_cxx_query(query_state)
1427    }
1428
1429    /// Gets a state from the provider if there is a `rule_type` in the received `road_position`.
1430    ///
1431    /// # Arguments
1432    /// * `road_position` - A position in the road geometry.
1433    /// * `rule_type` - A Rule Type.
1434    /// * `tolerance` - The tolerance in which to look for the Rule of type `rule_type` around the `road_position`.
1435    ///
1436    /// # Returns
1437    /// An Option containing the [StateProviderQuery] with a [DiscreteValue] if `rule_type` matches with any rule's type near `road_position`.
1438    /// Otherwise, None is returned.
1439    pub fn get_state_by_rule_type(
1440        &self,
1441        road_position: &RoadPosition,
1442        rule_type: RuleType,
1443        tolerance: f64,
1444    ) -> Option<StateProviderQuery<DiscreteValue>> {
1445        let query_state = maliput_sys::api::rules::ffi::DiscreteValueRuleStateProvider_GetStateByType(
1446            self.state_provider,
1447            &road_position.rp,
1448            &rule_type.to_string(),
1449            tolerance,
1450        );
1451        Self::next_state_from_cxx_query(query_state)
1452    }
1453
1454    // Internal helper to avoid code duplication.
1455    fn next_state_from_cxx_query(
1456        query_state: cxx::UniquePtr<maliput_sys::api::rules::ffi::DiscreteValueRuleStateProviderQuery>,
1457    ) -> Option<StateProviderQuery<DiscreteValue>> {
1458        if query_state.is_null() {
1459            return None;
1460        }
1461        let next_state = maliput_sys::api::rules::ffi::DiscreteValueRuleStateProviderQuery_next(&query_state);
1462        Some(StateProviderQuery {
1463            state: discrete_value_from_discrete_value_cxx(
1464                &maliput_sys::api::rules::ffi::DiscreteValueRuleStateProviderQuery_state(&query_state),
1465            ),
1466            next: if next_state.is_null() {
1467                None
1468            } else {
1469                Some(NextState {
1470                    next_state: discrete_value_from_discrete_value_cxx(&next_state.state),
1471                    duration_until: if next_state.duration_until.is_null() {
1472                        None
1473                    } else {
1474                        Some(next_state.duration_until.value)
1475                    },
1476                })
1477            },
1478        })
1479    }
1480}
1481
1482/// Provides the dynamic state of [RangeValueRule]s.
1483///
1484/// While a [RoadRulebook] provides the static definitions of rules, a
1485/// `RangeValueRuleStateProvider` provides the current state of those rules
1486/// at runtime. This allows for querying what state a rule is currently in,
1487/// which is essential for dynamic systems where rule states can change over
1488/// time (e.g., variable speed limits based on types of roads).
1489pub struct RangeValueRuleStateProvider<'a> {
1490    pub(super) state_provider: &'a maliput_sys::api::rules::ffi::RangeValueRuleStateProvider,
1491}
1492
1493impl<'a> RangeValueRuleStateProvider<'a> {
1494    /// Gets a state from the provider based on it's `rule_id`.
1495    ///
1496    /// # Arguments
1497    /// * `rule_id` - A Rule ID.
1498    ///
1499    /// # Returns
1500    /// An Option containing the [StateProviderQuery] with a [Range] if the `rule_id` matches with any rule.
1501    /// Otherwise, None is returned.
1502    pub fn get_state_by_rule_id(&self, rule_id: &String) -> Option<StateProviderQuery<Range>> {
1503        let query_state =
1504            maliput_sys::api::rules::ffi::RangeValueRuleStateProvider_GetStateById(self.state_provider, rule_id);
1505        Self::next_state_from_cxx_query(query_state)
1506    }
1507
1508    /// Gets a state from the provider if there is a `rule_type` in the received `road_position`.
1509    ///
1510    /// # Arguments
1511    /// * `road_position` - A position in the road geometry.
1512    /// * `rule_type` - A Rule Type.
1513    /// * `tolerance` - The tolerance in which to look for the Rule of type `rule_type` around the `road_position`.
1514    ///
1515    /// # Returns
1516    /// An Option containing the [StateProviderQuery] with a [Range] if `rule_type` matches with any rule's type near `road_position`.
1517    /// Otherwise, None is returned.
1518    pub fn get_state_by_rule_type(
1519        &self,
1520        road_position: &RoadPosition,
1521        rule_type: RuleType,
1522        tolerance: f64,
1523    ) -> Option<StateProviderQuery<Range>> {
1524        let query_state = maliput_sys::api::rules::ffi::RangeValueRuleStateProvider_GetStateByType(
1525            self.state_provider,
1526            &road_position.rp,
1527            &rule_type.to_string(),
1528            tolerance,
1529        );
1530        Self::next_state_from_cxx_query(query_state)
1531    }
1532
1533    // Internal helper to avoid code duplication.
1534    fn next_state_from_cxx_query(
1535        query_state: cxx::UniquePtr<maliput_sys::api::rules::ffi::RangeValueRuleStateProviderQuery>,
1536    ) -> Option<StateProviderQuery<Range>> {
1537        if query_state.is_null() {
1538            return None;
1539        }
1540        let next_state = maliput_sys::api::rules::ffi::RangeValueRuleStateProviderQuery_next(&query_state);
1541        Some(StateProviderQuery {
1542            state: range_value_from_range_value_cxx(
1543                &maliput_sys::api::rules::ffi::RangeValueRuleStateProviderQuery_state(&query_state),
1544            ),
1545            next: if next_state.is_null() {
1546                None
1547            } else {
1548                Some(NextState {
1549                    next_state: range_value_from_range_value_cxx(&next_state.state),
1550                    duration_until: if next_state.duration_until.is_null() {
1551                        None
1552                    } else {
1553                        Some(next_state.duration_until.value)
1554                    },
1555                })
1556            },
1557        })
1558    }
1559}
1560
1561// Auxiliary method to create a [Vec<Range>] from a [cxx::Vector<RangeValueRuleRange>].
1562fn range_values_from_cxx(
1563    range_values_cxx: &cxx::Vector<maliput_sys::api::rules::ffi::RangeValueRuleRange>,
1564) -> Vec<Range> {
1565    range_values_cxx
1566        .iter()
1567        .map(|range| Range {
1568            rule_state: RuleStateBase {
1569                severity: maliput_sys::api::rules::ffi::RangeValueRuleRange_severity(range),
1570                related_rules: maliput_sys::api::rules::ffi::RangeValueRuleRange_related_rules(range),
1571                related_unique_ids: maliput_sys::api::rules::ffi::RangeValueRuleRange_related_unique_ids(range),
1572            },
1573            description: maliput_sys::api::rules::ffi::RangeValueRuleRange_description(range),
1574            min: maliput_sys::api::rules::ffi::RangeValueRuleRange_min(range),
1575            max: maliput_sys::api::rules::ffi::RangeValueRuleRange_max(range),
1576        })
1577        .collect()
1578}
1579
1580// Auxiliary method to create a [Vec<DiscreteValue>] from a [cxx::Vector<DiscreteValueRuleDiscreteValue>].
1581fn discrete_values_from_cxx(
1582    discrete_values_cxx: &cxx::Vector<maliput_sys::api::rules::ffi::DiscreteValueRuleDiscreteValue>,
1583) -> Vec<DiscreteValue> {
1584    discrete_values_cxx
1585        .iter()
1586        .map(discrete_value_from_discrete_value_cxx)
1587        .collect()
1588}
1589
1590// Auxiliary method to create a [DiscreteValue] from a [maliput_sys::api::rules::ffi::DiscreteValueRuleDiscreteValue].
1591pub(crate) fn discrete_value_from_discrete_value_cxx(
1592    discrete_value: &maliput_sys::api::rules::ffi::DiscreteValueRuleDiscreteValue,
1593) -> DiscreteValue {
1594    DiscreteValue {
1595        rule_state: RuleStateBase {
1596            severity: maliput_sys::api::rules::ffi::DiscreteValueRuleDiscreteValue_severity(discrete_value),
1597            related_rules: maliput_sys::api::rules::ffi::DiscreteValueRuleDiscreteValue_related_rules(discrete_value),
1598            related_unique_ids: maliput_sys::api::rules::ffi::DiscreteValueRuleDiscreteValue_related_unique_ids(
1599                discrete_value,
1600            ),
1601        },
1602        value: maliput_sys::api::rules::ffi::DiscreteValueRuleDiscreteValue_value(discrete_value),
1603    }
1604}
1605
1606// Auxiliary method to create a [Range] from a [maliput_sys::api::rules::ffi::RangeValueRuleRange].
1607fn range_value_from_range_value_cxx(range: &maliput_sys::api::rules::ffi::RangeValueRuleRange) -> Range {
1608    Range {
1609        rule_state: RuleStateBase {
1610            severity: maliput_sys::api::rules::ffi::RangeValueRuleRange_severity(range),
1611            related_rules: maliput_sys::api::rules::ffi::RangeValueRuleRange_related_rules(range),
1612            related_unique_ids: maliput_sys::api::rules::ffi::RangeValueRuleRange_related_unique_ids(range),
1613        },
1614        description: maliput_sys::api::rules::ffi::RangeValueRuleRange_description(range),
1615        min: maliput_sys::api::rules::ffi::RangeValueRuleRange_min(range),
1616        max: maliput_sys::api::rules::ffi::RangeValueRuleRange_max(range),
1617    }
1618}
1619
1620#[derive(Debug, Copy, Clone, PartialEq, Eq, Display, EnumString)]
1621/// Defines the possible traffic sign types.
1622pub enum TrafficControlDeviceType {
1623    None,
1624    Other,
1625    Stop,
1626    Yield,
1627    SpeedLimit,
1628    NoEntry,
1629    OneWay,
1630    PedestrianCrossing,
1631    NoLeftTurn,
1632    NoRightTurn,
1633    NoUTurn,
1634    SchoolZone,
1635    Construction,
1636    RailroadCrossing,
1637    NoOvertaking,
1638    AllWay,
1639    NoUTurnLeft,
1640    NoUTurnRight,
1641    StopLine,
1642    Crosswalk,
1643    DangerSpot,
1644    ZebraCrossing,
1645    Flight,
1646    Cattle,
1647    HorseRiders,
1648    Amphibians,
1649    FallingRocks,
1650    SnowOrIce,
1651    LooseGravel,
1652    Waterside,
1653    Clearance,
1654    MovableBridge,
1655    RightBeforeLeftNextIntersection,
1656    TurnLeft,
1657    TurnRight,
1658    DoubleTurnLeft,
1659    DoubleTurnRight,
1660    HillDownwards,
1661    HillUpwards,
1662    UnevenRoad,
1663    RoadSlipperyWetOrDirty,
1664    SideWinds,
1665    RoadNarrowing,
1666    RoadNarrowingRight,
1667    RoadNarrowingLeft,
1668    RoadWorks,
1669    TrafficQueues,
1670    TwoWayTraffic,
1671    AttentionTrafficLight,
1672    Pedestrians,
1673    ChildrenCrossing,
1674    CycleRoute,
1675    DeerCrossing,
1676    UngatedLevelCrossing,
1677    LevelCrossingMarker,
1678    RailwayTrafficPriority,
1679    GiveWay,
1680    PriorityToOppositeDirection,
1681    PriorityToOppositeDirectionUpsideDown,
1682    PrescribedLeftTurn,
1683    PrescribedRightTurn,
1684    PrescribedStraight,
1685    PrescribedRightWay,
1686    PrescribedLeftWay,
1687    PrescribedRightTurnAndStraight,
1688    PrescribedLeftTurnAndStraight,
1689    PrescribedLeftTurnAndRightTurn,
1690    PrescribedLeftTurnRightTurnAndStraight,
1691    Roundabout,
1692    OnewayLeft,
1693    OnewayRight,
1694    PassLeft,
1695    PassRight,
1696    SideLaneOpenForTraffic,
1697    SideLaneClosedForTraffic,
1698    SideLaneClosingForTraffic,
1699    BusStop,
1700    TaxiStand,
1701    BicyclesOnly,
1702    HorseRidersOnly,
1703    PedestriansOnly,
1704    BicyclesPedestriansSharedOnly,
1705    BicyclesPedestriansSeparatedLeftOnly,
1706    BicyclesPedestriansSeparatedRightOnly,
1707    PedestrianZoneBegin,
1708    PedestrianZoneEnd,
1709    BicycleRoadBegin,
1710    BicycleRoadEnd,
1711    BusLane,
1712    BusLaneBegin,
1713    BusLaneEnd,
1714    AllProhibited,
1715    MotorizedMultitrackProhibited,
1716    TrucksProhibited,
1717    BicyclesProhibited,
1718    MotorcyclesProhibited,
1719    MopedsProhibited,
1720    HorseRidersProhibited,
1721    HorseCarriagesProhibited,
1722    CattleProhibited,
1723    BusesProhibited,
1724    CarsProhibited,
1725    CarsTrailersProhibited,
1726    TrucksTrailersProhibited,
1727    TractorsProhibited,
1728    PedestriansProhibited,
1729    MotorVehiclesProhibited,
1730    HazardousGoodsVehiclesProhibited,
1731    OverWeightVehiclesProhibited,
1732    VehiclesAxleOverWeightProhibited,
1733    VehiclesExcessWidthProhibited,
1734    VehiclesExcessHeightProhibited,
1735    VehiclesExcessLengthProhibited,
1736    DoNotEnter,
1737    SnowChainsRequired,
1738    WaterPollutantVehiclesProhibited,
1739    EnvironmentalZoneBegin,
1740    EnvironmentalZoneEnd,
1741    PrescribedUTurnLeft,
1742    PrescribedUTurnRight,
1743    MinimumDistanceForTrucks,
1744    SpeedLimitBegin,
1745    SpeedLimitZoneBegin,
1746    SpeedLimitZoneEnd,
1747    MinimumSpeedBegin,
1748    OvertakingBanBegin,
1749    OvertakingBanForTrucksBegin,
1750    SpeedLimitEnd,
1751    MinimumSpeedEnd,
1752    OvertakingBanEnd,
1753    OvertakingBanForTrucksEnd,
1754    AllRestrictionsEnd,
1755    NoStopping,
1756    NoParking,
1757    NoParkingZoneBegin,
1758    NoParkingZoneEnd,
1759    RightOfWayNextIntersection,
1760    RightOfWayBegin,
1761    RightOfWayEnd,
1762    PriorityOverOppositeDirection,
1763    PriorityOverOppositeDirectionUpsideDown,
1764    TownBegin,
1765    TownEnd,
1766    CarParking,
1767    CarParkingZoneBegin,
1768    CarParkingZoneEnd,
1769    SidewalkHalfParkingLeft,
1770    SidewalkHalfParkingRight,
1771    SidewalkParkingLeft,
1772    SidewalkParkingRight,
1773    SidewalkPerpendicularHalfParkingLeft,
1774    SidewalkPerpendicularHalfParkingRight,
1775    SidewalkPerpendicularParkingLeft,
1776    SidewalkPerpendicularParkingRight,
1777    LivingStreetBegin,
1778    LivingStreetEnd,
1779    Tunnel,
1780    EmergencyStoppingLeft,
1781    EmergencyStoppingRight,
1782    HighwayBegin,
1783    HighwayEnd,
1784    ExpresswayBegin,
1785    ExpresswayEnd,
1786    NamedHighwayExit,
1787    NamedExpresswayExit,
1788    NamedRoadExit,
1789    HighwayExit,
1790    ExpresswayExit,
1791    OnewayStreet,
1792    CrossingGuards,
1793    Deadend,
1794    DeadendExcludingDesignatedActors,
1795    FirstAidStation,
1796    PoliceStation,
1797    Telephone,
1798    FillingStation,
1799    Hotel,
1800    Inn,
1801    Kiosk,
1802    Toilet,
1803    Chapel,
1804    TouristInfo,
1805    RepairService,
1806    PedestrianUnderpass,
1807    PedestrianBridge,
1808    CamperPlace,
1809    AdvisorySpeedLimitBegin,
1810    AdvisorySpeedLimitEnd,
1811    PlaceName,
1812    TouristAttraction,
1813    TouristRoute,
1814    TouristArea,
1815    ShoulderNotPassableMotorVehicles,
1816    ShoulderUnsafeTrucksTractors,
1817    TollBegin,
1818    TollEnd,
1819    TollRoad,
1820    Customs,
1821    InternationalBorderInfo,
1822    StreetlightRedBand,
1823    FederalHighwayRouteNumber,
1824    HighwayRouteNumber,
1825    HighwayInterchangeNumber,
1826    EuropeanRouteNumber,
1827    FederalHighwayDirectionLeft,
1828    FederalHighwayDirectionRight,
1829    PrimaryRoadDirectionLeft,
1830    PrimaryRoadDirectionRight,
1831    SecondaryRoadDirectionLeft,
1832    SecondaryRoadDirectionRight,
1833    DirectionDesignatedActorsLeft,
1834    DirectionDesignatedActorsRight,
1835    RoutingDesignatedActors,
1836    DirectionToHighwayLeft,
1837    DirectionToHighwayRight,
1838    DirectionToLocalDestinationLeft,
1839    DirectionToLocalDestinationRight,
1840    ConsolidatedDirections,
1841    StreetName,
1842    DirectionPreannouncement,
1843    DirectionPreannouncementLaneConfig,
1844    DirectionPreannouncementHighwayEntries,
1845    HighwayAnnouncement,
1846    OtherRoadAnnouncement,
1847    HighwayAnnouncementTruckStop,
1848    HighwayPreannouncementDirections,
1849    PoleExit,
1850    HighwayDistanceBoard,
1851    DetourLeft,
1852    DetourRight,
1853    NumberedDetour,
1854    DetourBegin,
1855    DetourEnd,
1856    DetourRoutingBoard,
1857    OptionalDetour,
1858    OptionalDetourRouting,
1859    RouteRecommendation,
1860    RouteRecommendationEnd,
1861    AnnounceLaneTransitionLeft,
1862    AnnounceLaneTransitionRight,
1863    AnnounceRightLaneEnd,
1864    AnnounceLeftLaneEnd,
1865    AnnounceRightLaneBegin,
1866    AnnounceLeftLaneBegin,
1867    AnnounceLaneConsolidation,
1868    DetourCityBlock,
1869    Gate,
1870    PoleWarning,
1871    TrafficCone,
1872    MobileLaneClosure,
1873    ReflectorPost,
1874    DirectionalBoardWarning,
1875    GuidingPlate,
1876    GuidingPlateWedges,
1877    ParkingHazard,
1878    TrafficLightGreenArrow,
1879    Text,
1880    Space,
1881    Time,
1882    Arrow,
1883    ConstrainedTo,
1884    Except,
1885    ValidForDistance,
1886    PriorityRoadBottomLeftFourWay,
1887    PriorityRoadTopLeftFourWay,
1888    PriorityRoadBottomLeftThreeWayStraight,
1889    PriorityRoadBottomLeftThreeWaySideways,
1890    PriorityRoadTopLeftThreeWayStraight,
1891    PriorityRoadBottomRightFourWay,
1892    PriorityRoadTopRightFourWay,
1893    PriorityRoadBottomRightThreeWayStraight,
1894    PriorityRoadBottomRightThreeWaySideway,
1895    PriorityRoadTopRightThreeWayStraight,
1896    ValidInDistance,
1897    StopIn,
1898    LeftArrow,
1899    LeftBendArrow,
1900    RightArrow,
1901    RightBendArrow,
1902    Accident,
1903    Snow,
1904    Fog,
1905    RollingHighwayInformation,
1906    Services,
1907    TimeRange,
1908    ParkingDiscTimeRestriction,
1909    Weight,
1910    Wet,
1911    ParkingConstraint,
1912    NoWaitingSideStripes,
1913    Rain,
1914    SnowRain,
1915    Night,
1916    Stop4Way,
1917    Truck,
1918    TractorsMayBePassed,
1919    Hazardous,
1920    Trailer,
1921    Zone,
1922    Motorcycle,
1923    MotorcycleAllowed,
1924    Car,
1925    EmergencyLane,
1926    Unknown,
1927}
1928
1929/// Domain alias for traffic sign semantic types.
1930pub type TrafficSignType = TrafficControlDeviceType;
1931
1932#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1933/// Defines the unit for a traffic sign's numeric value.
1934pub enum TrafficSignValueUnit {
1935    MetersPerSecond,
1936    KilometersPerHour,
1937    MilesPerHour,
1938    Meters,
1939    Kilometers,
1940    Feet,
1941    Miles,
1942    Percent,
1943    Kilograms,
1944    MetricTons,
1945}
1946
1947#[derive(Debug, Copy, Clone, PartialEq)]
1948/// Holds a numeric value and its associated unit for a traffic sign.
1949pub struct TrafficSignValue {
1950    pub value: f64,
1951    pub unit: TrafficSignValueUnit,
1952}
1953
1954pub(crate) fn traffic_control_device_type_from_cpp(
1955    sign_type: &maliput_sys::api::rules::ffi::TrafficControlDeviceType,
1956) -> TrafficControlDeviceType {
1957    match *sign_type {
1958        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNone => TrafficSignType::None,
1959        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOther => TrafficSignType::Other,
1960        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kStop => TrafficSignType::Stop,
1961        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kYield => TrafficSignType::Yield,
1962        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSpeedLimit => TrafficSignType::SpeedLimit,
1963        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoEntry => TrafficSignType::NoEntry,
1964        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOneWay => TrafficSignType::OneWay,
1965        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPedestrianCrossing => {
1966            TrafficSignType::PedestrianCrossing
1967        }
1968        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoLeftTurn => TrafficSignType::NoLeftTurn,
1969        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoRightTurn => TrafficSignType::NoRightTurn,
1970        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoUTurn => TrafficSignType::NoUTurn,
1971        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSchoolZone => TrafficSignType::SchoolZone,
1972        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kConstruction => TrafficSignType::Construction,
1973        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRailroadCrossing => TrafficSignType::RailroadCrossing,
1974        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoOvertaking => TrafficSignType::NoOvertaking,
1975        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAllWay => TrafficSignType::AllWay,
1976        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoUTurnLeft => TrafficSignType::NoUTurnLeft,
1977        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoUTurnRight => TrafficSignType::NoUTurnRight,
1978        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kStopLine => TrafficSignType::StopLine,
1979        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCrosswalk => TrafficSignType::Crosswalk,
1980        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDangerSpot => TrafficSignType::DangerSpot,
1981        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kZebraCrossing => TrafficSignType::ZebraCrossing,
1982        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kFlight => TrafficSignType::Flight,
1983        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCattle => TrafficSignType::Cattle,
1984        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHorseRiders => TrafficSignType::HorseRiders,
1985        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAmphibians => TrafficSignType::Amphibians,
1986        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kFallingRocks => TrafficSignType::FallingRocks,
1987        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSnowOrIce => TrafficSignType::SnowOrIce,
1988        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kLooseGravel => TrafficSignType::LooseGravel,
1989        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kWaterside => TrafficSignType::Waterside,
1990        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kClearance => TrafficSignType::Clearance,
1991        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMovableBridge => TrafficSignType::MovableBridge,
1992        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRightBeforeLeftNextIntersection => {
1993            TrafficSignType::RightBeforeLeftNextIntersection
1994        }
1995        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTurnLeft => TrafficSignType::TurnLeft,
1996        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTurnRight => TrafficSignType::TurnRight,
1997        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDoubleTurnLeft => TrafficSignType::DoubleTurnLeft,
1998        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDoubleTurnRight => TrafficSignType::DoubleTurnRight,
1999        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHillDownwards => TrafficSignType::HillDownwards,
2000        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHillUpwards => TrafficSignType::HillUpwards,
2001        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kUnevenRoad => TrafficSignType::UnevenRoad,
2002        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRoadSlipperyWetOrDirty => {
2003            TrafficSignType::RoadSlipperyWetOrDirty
2004        }
2005        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSideWinds => TrafficSignType::SideWinds,
2006        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRoadNarrowing => TrafficSignType::RoadNarrowing,
2007        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRoadNarrowingRight => {
2008            TrafficSignType::RoadNarrowingRight
2009        }
2010        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRoadNarrowingLeft => {
2011            TrafficSignType::RoadNarrowingLeft
2012        }
2013        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRoadWorks => TrafficSignType::RoadWorks,
2014        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTrafficQueues => TrafficSignType::TrafficQueues,
2015        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTwoWayTraffic => TrafficSignType::TwoWayTraffic,
2016        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAttentionTrafficLight => {
2017            TrafficSignType::AttentionTrafficLight
2018        }
2019        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPedestrians => TrafficSignType::Pedestrians,
2020        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kChildrenCrossing => TrafficSignType::ChildrenCrossing,
2021        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCycleRoute => TrafficSignType::CycleRoute,
2022        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDeerCrossing => TrafficSignType::DeerCrossing,
2023        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kUngatedLevelCrossing => {
2024            TrafficSignType::UngatedLevelCrossing
2025        }
2026        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kLevelCrossingMarker => {
2027            TrafficSignType::LevelCrossingMarker
2028        }
2029        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRailwayTrafficPriority => {
2030            TrafficSignType::RailwayTrafficPriority
2031        }
2032        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kGiveWay => TrafficSignType::GiveWay,
2033        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityToOppositeDirection => {
2034            TrafficSignType::PriorityToOppositeDirection
2035        }
2036        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityToOppositeDirectionUpsideDown => {
2037            TrafficSignType::PriorityToOppositeDirectionUpsideDown
2038        }
2039        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedLeftTurn => {
2040            TrafficSignType::PrescribedLeftTurn
2041        }
2042        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedRightTurn => {
2043            TrafficSignType::PrescribedRightTurn
2044        }
2045        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedStraight => {
2046            TrafficSignType::PrescribedStraight
2047        }
2048        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedRightWay => {
2049            TrafficSignType::PrescribedRightWay
2050        }
2051        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedLeftWay => {
2052            TrafficSignType::PrescribedLeftWay
2053        }
2054        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedRightTurnAndStraight => {
2055            TrafficSignType::PrescribedRightTurnAndStraight
2056        }
2057        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedLeftTurnAndStraight => {
2058            TrafficSignType::PrescribedLeftTurnAndStraight
2059        }
2060        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedLeftTurnAndRightTurn => {
2061            TrafficSignType::PrescribedLeftTurnAndRightTurn
2062        }
2063        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedLeftTurnRightTurnAndStraight => {
2064            TrafficSignType::PrescribedLeftTurnRightTurnAndStraight
2065        }
2066        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRoundabout => TrafficSignType::Roundabout,
2067        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOnewayLeft => TrafficSignType::OnewayLeft,
2068        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOnewayRight => TrafficSignType::OnewayRight,
2069        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPassLeft => TrafficSignType::PassLeft,
2070        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPassRight => TrafficSignType::PassRight,
2071        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSideLaneOpenForTraffic => {
2072            TrafficSignType::SideLaneOpenForTraffic
2073        }
2074        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSideLaneClosedForTraffic => {
2075            TrafficSignType::SideLaneClosedForTraffic
2076        }
2077        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSideLaneClosingForTraffic => {
2078            TrafficSignType::SideLaneClosingForTraffic
2079        }
2080        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBusStop => TrafficSignType::BusStop,
2081        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTaxiStand => TrafficSignType::TaxiStand,
2082        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBicyclesOnly => TrafficSignType::BicyclesOnly,
2083        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHorseRidersOnly => TrafficSignType::HorseRidersOnly,
2084        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPedestriansOnly => TrafficSignType::PedestriansOnly,
2085        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBicyclesPedestriansSharedOnly => {
2086            TrafficSignType::BicyclesPedestriansSharedOnly
2087        }
2088        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBicyclesPedestriansSeparatedLeftOnly => {
2089            TrafficSignType::BicyclesPedestriansSeparatedLeftOnly
2090        }
2091        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBicyclesPedestriansSeparatedRightOnly => {
2092            TrafficSignType::BicyclesPedestriansSeparatedRightOnly
2093        }
2094        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPedestrianZoneBegin => {
2095            TrafficSignType::PedestrianZoneBegin
2096        }
2097        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPedestrianZoneEnd => {
2098            TrafficSignType::PedestrianZoneEnd
2099        }
2100        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBicycleRoadBegin => TrafficSignType::BicycleRoadBegin,
2101        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBicycleRoadEnd => TrafficSignType::BicycleRoadEnd,
2102        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBusLane => TrafficSignType::BusLane,
2103        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBusLaneBegin => TrafficSignType::BusLaneBegin,
2104        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBusLaneEnd => TrafficSignType::BusLaneEnd,
2105        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAllProhibited => TrafficSignType::AllProhibited,
2106        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMotorizedMultitrackProhibited => {
2107            TrafficSignType::MotorizedMultitrackProhibited
2108        }
2109        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTrucksProhibited => TrafficSignType::TrucksProhibited,
2110        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBicyclesProhibited => {
2111            TrafficSignType::BicyclesProhibited
2112        }
2113        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMotorcyclesProhibited => {
2114            TrafficSignType::MotorcyclesProhibited
2115        }
2116        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMopedsProhibited => TrafficSignType::MopedsProhibited,
2117        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHorseRidersProhibited => {
2118            TrafficSignType::HorseRidersProhibited
2119        }
2120        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHorseCarriagesProhibited => {
2121            TrafficSignType::HorseCarriagesProhibited
2122        }
2123        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCattleProhibited => TrafficSignType::CattleProhibited,
2124        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBusesProhibited => TrafficSignType::BusesProhibited,
2125        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCarsProhibited => TrafficSignType::CarsProhibited,
2126        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCarsTrailersProhibited => {
2127            TrafficSignType::CarsTrailersProhibited
2128        }
2129        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTrucksTrailersProhibited => {
2130            TrafficSignType::TrucksTrailersProhibited
2131        }
2132        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTractorsProhibited => {
2133            TrafficSignType::TractorsProhibited
2134        }
2135        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPedestriansProhibited => {
2136            TrafficSignType::PedestriansProhibited
2137        }
2138        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMotorVehiclesProhibited => {
2139            TrafficSignType::MotorVehiclesProhibited
2140        }
2141        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHazardousGoodsVehiclesProhibited => {
2142            TrafficSignType::HazardousGoodsVehiclesProhibited
2143        }
2144        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOverWeightVehiclesProhibited => {
2145            TrafficSignType::OverWeightVehiclesProhibited
2146        }
2147        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kVehiclesAxleOverWeightProhibited => {
2148            TrafficSignType::VehiclesAxleOverWeightProhibited
2149        }
2150        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kVehiclesExcessWidthProhibited => {
2151            TrafficSignType::VehiclesExcessWidthProhibited
2152        }
2153        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kVehiclesExcessHeightProhibited => {
2154            TrafficSignType::VehiclesExcessHeightProhibited
2155        }
2156        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kVehiclesExcessLengthProhibited => {
2157            TrafficSignType::VehiclesExcessLengthProhibited
2158        }
2159        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDoNotEnter => TrafficSignType::DoNotEnter,
2160        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSnowChainsRequired => {
2161            TrafficSignType::SnowChainsRequired
2162        }
2163        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kWaterPollutantVehiclesProhibited => {
2164            TrafficSignType::WaterPollutantVehiclesProhibited
2165        }
2166        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kEnvironmentalZoneBegin => {
2167            TrafficSignType::EnvironmentalZoneBegin
2168        }
2169        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kEnvironmentalZoneEnd => {
2170            TrafficSignType::EnvironmentalZoneEnd
2171        }
2172        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedUTurnLeft => {
2173            TrafficSignType::PrescribedUTurnLeft
2174        }
2175        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedUTurnRight => {
2176            TrafficSignType::PrescribedUTurnRight
2177        }
2178        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMinimumDistanceForTrucks => {
2179            TrafficSignType::MinimumDistanceForTrucks
2180        }
2181        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSpeedLimitBegin => TrafficSignType::SpeedLimitBegin,
2182        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSpeedLimitZoneBegin => {
2183            TrafficSignType::SpeedLimitZoneBegin
2184        }
2185        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSpeedLimitZoneEnd => {
2186            TrafficSignType::SpeedLimitZoneEnd
2187        }
2188        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMinimumSpeedBegin => {
2189            TrafficSignType::MinimumSpeedBegin
2190        }
2191        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOvertakingBanBegin => {
2192            TrafficSignType::OvertakingBanBegin
2193        }
2194        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOvertakingBanForTrucksBegin => {
2195            TrafficSignType::OvertakingBanForTrucksBegin
2196        }
2197        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSpeedLimitEnd => TrafficSignType::SpeedLimitEnd,
2198        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMinimumSpeedEnd => TrafficSignType::MinimumSpeedEnd,
2199        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOvertakingBanEnd => TrafficSignType::OvertakingBanEnd,
2200        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOvertakingBanForTrucksEnd => {
2201            TrafficSignType::OvertakingBanForTrucksEnd
2202        }
2203        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAllRestrictionsEnd => {
2204            TrafficSignType::AllRestrictionsEnd
2205        }
2206        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoStopping => TrafficSignType::NoStopping,
2207        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoParking => TrafficSignType::NoParking,
2208        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoParkingZoneBegin => {
2209            TrafficSignType::NoParkingZoneBegin
2210        }
2211        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoParkingZoneEnd => TrafficSignType::NoParkingZoneEnd,
2212        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRightOfWayNextIntersection => {
2213            TrafficSignType::RightOfWayNextIntersection
2214        }
2215        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRightOfWayBegin => TrafficSignType::RightOfWayBegin,
2216        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRightOfWayEnd => TrafficSignType::RightOfWayEnd,
2217        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityOverOppositeDirection => {
2218            TrafficSignType::PriorityOverOppositeDirection
2219        }
2220        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityOverOppositeDirectionUpsideDown => {
2221            TrafficSignType::PriorityOverOppositeDirectionUpsideDown
2222        }
2223        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTownBegin => TrafficSignType::TownBegin,
2224        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTownEnd => TrafficSignType::TownEnd,
2225        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCarParking => TrafficSignType::CarParking,
2226        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCarParkingZoneBegin => {
2227            TrafficSignType::CarParkingZoneBegin
2228        }
2229        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCarParkingZoneEnd => {
2230            TrafficSignType::CarParkingZoneEnd
2231        }
2232        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSidewalkHalfParkingLeft => {
2233            TrafficSignType::SidewalkHalfParkingLeft
2234        }
2235        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSidewalkHalfParkingRight => {
2236            TrafficSignType::SidewalkHalfParkingRight
2237        }
2238        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSidewalkParkingLeft => {
2239            TrafficSignType::SidewalkParkingLeft
2240        }
2241        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSidewalkParkingRight => {
2242            TrafficSignType::SidewalkParkingRight
2243        }
2244        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSidewalkPerpendicularHalfParkingLeft => {
2245            TrafficSignType::SidewalkPerpendicularHalfParkingLeft
2246        }
2247        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSidewalkPerpendicularHalfParkingRight => {
2248            TrafficSignType::SidewalkPerpendicularHalfParkingRight
2249        }
2250        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSidewalkPerpendicularParkingLeft => {
2251            TrafficSignType::SidewalkPerpendicularParkingLeft
2252        }
2253        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSidewalkPerpendicularParkingRight => {
2254            TrafficSignType::SidewalkPerpendicularParkingRight
2255        }
2256        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kLivingStreetBegin => {
2257            TrafficSignType::LivingStreetBegin
2258        }
2259        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kLivingStreetEnd => TrafficSignType::LivingStreetEnd,
2260        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTunnel => TrafficSignType::Tunnel,
2261        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kEmergencyStoppingLeft => {
2262            TrafficSignType::EmergencyStoppingLeft
2263        }
2264        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kEmergencyStoppingRight => {
2265            TrafficSignType::EmergencyStoppingRight
2266        }
2267        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayBegin => TrafficSignType::HighwayBegin,
2268        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayEnd => TrafficSignType::HighwayEnd,
2269        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kExpresswayBegin => TrafficSignType::ExpresswayBegin,
2270        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kExpresswayEnd => TrafficSignType::ExpresswayEnd,
2271        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNamedHighwayExit => TrafficSignType::NamedHighwayExit,
2272        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNamedExpresswayExit => {
2273            TrafficSignType::NamedExpresswayExit
2274        }
2275        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNamedRoadExit => TrafficSignType::NamedRoadExit,
2276        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayExit => TrafficSignType::HighwayExit,
2277        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kExpresswayExit => TrafficSignType::ExpresswayExit,
2278        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOnewayStreet => TrafficSignType::OnewayStreet,
2279        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCrossingGuards => TrafficSignType::CrossingGuards,
2280        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDeadend => TrafficSignType::Deadend,
2281        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDeadendExcludingDesignatedActors => {
2282            TrafficSignType::DeadendExcludingDesignatedActors
2283        }
2284        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kFirstAidStation => TrafficSignType::FirstAidStation,
2285        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPoliceStation => TrafficSignType::PoliceStation,
2286        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTelephone => TrafficSignType::Telephone,
2287        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kFillingStation => TrafficSignType::FillingStation,
2288        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHotel => TrafficSignType::Hotel,
2289        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kInn => TrafficSignType::Inn,
2290        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kKiosk => TrafficSignType::Kiosk,
2291        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kToilet => TrafficSignType::Toilet,
2292        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kChapel => TrafficSignType::Chapel,
2293        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTouristInfo => TrafficSignType::TouristInfo,
2294        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRepairService => TrafficSignType::RepairService,
2295        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPedestrianUnderpass => {
2296            TrafficSignType::PedestrianUnderpass
2297        }
2298        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPedestrianBridge => TrafficSignType::PedestrianBridge,
2299        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCamperPlace => TrafficSignType::CamperPlace,
2300        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAdvisorySpeedLimitBegin => {
2301            TrafficSignType::AdvisorySpeedLimitBegin
2302        }
2303        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAdvisorySpeedLimitEnd => {
2304            TrafficSignType::AdvisorySpeedLimitEnd
2305        }
2306        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPlaceName => TrafficSignType::PlaceName,
2307        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTouristAttraction => {
2308            TrafficSignType::TouristAttraction
2309        }
2310        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTouristRoute => TrafficSignType::TouristRoute,
2311        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTouristArea => TrafficSignType::TouristArea,
2312        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kShoulderNotPassableMotorVehicles => {
2313            TrafficSignType::ShoulderNotPassableMotorVehicles
2314        }
2315        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kShoulderUnsafeTrucksTractors => {
2316            TrafficSignType::ShoulderUnsafeTrucksTractors
2317        }
2318        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTollBegin => TrafficSignType::TollBegin,
2319        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTollEnd => TrafficSignType::TollEnd,
2320        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTollRoad => TrafficSignType::TollRoad,
2321        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCustoms => TrafficSignType::Customs,
2322        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kInternationalBorderInfo => {
2323            TrafficSignType::InternationalBorderInfo
2324        }
2325        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kStreetlightRedBand => {
2326            TrafficSignType::StreetlightRedBand
2327        }
2328        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kFederalHighwayRouteNumber => {
2329            TrafficSignType::FederalHighwayRouteNumber
2330        }
2331        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayRouteNumber => {
2332            TrafficSignType::HighwayRouteNumber
2333        }
2334        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayInterchangeNumber => {
2335            TrafficSignType::HighwayInterchangeNumber
2336        }
2337        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kEuropeanRouteNumber => {
2338            TrafficSignType::EuropeanRouteNumber
2339        }
2340        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kFederalHighwayDirectionLeft => {
2341            TrafficSignType::FederalHighwayDirectionLeft
2342        }
2343        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kFederalHighwayDirectionRight => {
2344            TrafficSignType::FederalHighwayDirectionRight
2345        }
2346        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrimaryRoadDirectionLeft => {
2347            TrafficSignType::PrimaryRoadDirectionLeft
2348        }
2349        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrimaryRoadDirectionRight => {
2350            TrafficSignType::PrimaryRoadDirectionRight
2351        }
2352        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSecondaryRoadDirectionLeft => {
2353            TrafficSignType::SecondaryRoadDirectionLeft
2354        }
2355        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSecondaryRoadDirectionRight => {
2356            TrafficSignType::SecondaryRoadDirectionRight
2357        }
2358        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionDesignatedActorsLeft => {
2359            TrafficSignType::DirectionDesignatedActorsLeft
2360        }
2361        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionDesignatedActorsRight => {
2362            TrafficSignType::DirectionDesignatedActorsRight
2363        }
2364        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRoutingDesignatedActors => {
2365            TrafficSignType::RoutingDesignatedActors
2366        }
2367        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionToHighwayLeft => {
2368            TrafficSignType::DirectionToHighwayLeft
2369        }
2370        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionToHighwayRight => {
2371            TrafficSignType::DirectionToHighwayRight
2372        }
2373        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionToLocalDestinationLeft => {
2374            TrafficSignType::DirectionToLocalDestinationLeft
2375        }
2376        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionToLocalDestinationRight => {
2377            TrafficSignType::DirectionToLocalDestinationRight
2378        }
2379        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kConsolidatedDirections => {
2380            TrafficSignType::ConsolidatedDirections
2381        }
2382        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kStreetName => TrafficSignType::StreetName,
2383        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionPreannouncement => {
2384            TrafficSignType::DirectionPreannouncement
2385        }
2386        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionPreannouncementLaneConfig => {
2387            TrafficSignType::DirectionPreannouncementLaneConfig
2388        }
2389        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionPreannouncementHighwayEntries => {
2390            TrafficSignType::DirectionPreannouncementHighwayEntries
2391        }
2392        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayAnnouncement => {
2393            TrafficSignType::HighwayAnnouncement
2394        }
2395        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOtherRoadAnnouncement => {
2396            TrafficSignType::OtherRoadAnnouncement
2397        }
2398        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayAnnouncementTruckStop => {
2399            TrafficSignType::HighwayAnnouncementTruckStop
2400        }
2401        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayPreannouncementDirections => {
2402            TrafficSignType::HighwayPreannouncementDirections
2403        }
2404        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPoleExit => TrafficSignType::PoleExit,
2405        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayDistanceBoard => {
2406            TrafficSignType::HighwayDistanceBoard
2407        }
2408        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDetourLeft => TrafficSignType::DetourLeft,
2409        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDetourRight => TrafficSignType::DetourRight,
2410        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNumberedDetour => TrafficSignType::NumberedDetour,
2411        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDetourBegin => TrafficSignType::DetourBegin,
2412        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDetourEnd => TrafficSignType::DetourEnd,
2413        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDetourRoutingBoard => {
2414            TrafficSignType::DetourRoutingBoard
2415        }
2416        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOptionalDetour => TrafficSignType::OptionalDetour,
2417        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOptionalDetourRouting => {
2418            TrafficSignType::OptionalDetourRouting
2419        }
2420        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRouteRecommendation => {
2421            TrafficSignType::RouteRecommendation
2422        }
2423        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRouteRecommendationEnd => {
2424            TrafficSignType::RouteRecommendationEnd
2425        }
2426        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAnnounceLaneTransitionLeft => {
2427            TrafficSignType::AnnounceLaneTransitionLeft
2428        }
2429        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAnnounceLaneTransitionRight => {
2430            TrafficSignType::AnnounceLaneTransitionRight
2431        }
2432        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAnnounceRightLaneEnd => {
2433            TrafficSignType::AnnounceRightLaneEnd
2434        }
2435        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAnnounceLeftLaneEnd => {
2436            TrafficSignType::AnnounceLeftLaneEnd
2437        }
2438        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAnnounceRightLaneBegin => {
2439            TrafficSignType::AnnounceRightLaneBegin
2440        }
2441        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAnnounceLeftLaneBegin => {
2442            TrafficSignType::AnnounceLeftLaneBegin
2443        }
2444        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAnnounceLaneConsolidation => {
2445            TrafficSignType::AnnounceLaneConsolidation
2446        }
2447        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDetourCityBlock => TrafficSignType::DetourCityBlock,
2448        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kGate => TrafficSignType::Gate,
2449        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPoleWarning => TrafficSignType::PoleWarning,
2450        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTrafficCone => TrafficSignType::TrafficCone,
2451        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMobileLaneClosure => {
2452            TrafficSignType::MobileLaneClosure
2453        }
2454        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kReflectorPost => TrafficSignType::ReflectorPost,
2455        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionalBoardWarning => {
2456            TrafficSignType::DirectionalBoardWarning
2457        }
2458        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kGuidingPlate => TrafficSignType::GuidingPlate,
2459        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kGuidingPlateWedges => {
2460            TrafficSignType::GuidingPlateWedges
2461        }
2462        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kParkingHazard => TrafficSignType::ParkingHazard,
2463        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTrafficLightGreenArrow => {
2464            TrafficSignType::TrafficLightGreenArrow
2465        }
2466        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kText => TrafficSignType::Text,
2467        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSpace => TrafficSignType::Space,
2468        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTime => TrafficSignType::Time,
2469        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kArrow => TrafficSignType::Arrow,
2470        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kConstrainedTo => TrafficSignType::ConstrainedTo,
2471        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kExcept => TrafficSignType::Except,
2472        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kValidForDistance => TrafficSignType::ValidForDistance,
2473        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadBottomLeftFourWay => {
2474            TrafficSignType::PriorityRoadBottomLeftFourWay
2475        }
2476        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadTopLeftFourWay => {
2477            TrafficSignType::PriorityRoadTopLeftFourWay
2478        }
2479        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadBottomLeftThreeWayStraight => {
2480            TrafficSignType::PriorityRoadBottomLeftThreeWayStraight
2481        }
2482        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadBottomLeftThreeWaySideways => {
2483            TrafficSignType::PriorityRoadBottomLeftThreeWaySideways
2484        }
2485        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadTopLeftThreeWayStraight => {
2486            TrafficSignType::PriorityRoadTopLeftThreeWayStraight
2487        }
2488        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadBottomRightFourWay => {
2489            TrafficSignType::PriorityRoadBottomRightFourWay
2490        }
2491        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadTopRightFourWay => {
2492            TrafficSignType::PriorityRoadTopRightFourWay
2493        }
2494        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadBottomRightThreeWayStraight => {
2495            TrafficSignType::PriorityRoadBottomRightThreeWayStraight
2496        }
2497        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadBottomRightThreeWaySideway => {
2498            TrafficSignType::PriorityRoadBottomRightThreeWaySideway
2499        }
2500        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadTopRightThreeWayStraight => {
2501            TrafficSignType::PriorityRoadTopRightThreeWayStraight
2502        }
2503        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kValidInDistance => TrafficSignType::ValidInDistance,
2504        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kStopIn => TrafficSignType::StopIn,
2505        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kLeftArrow => TrafficSignType::LeftArrow,
2506        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kLeftBendArrow => TrafficSignType::LeftBendArrow,
2507        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRightArrow => TrafficSignType::RightArrow,
2508        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRightBendArrow => TrafficSignType::RightBendArrow,
2509        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAccident => TrafficSignType::Accident,
2510        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSnow => TrafficSignType::Snow,
2511        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kFog => TrafficSignType::Fog,
2512        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRollingHighwayInformation => {
2513            TrafficSignType::RollingHighwayInformation
2514        }
2515        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kServices => TrafficSignType::Services,
2516        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTimeRange => TrafficSignType::TimeRange,
2517        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kParkingDiscTimeRestriction => {
2518            TrafficSignType::ParkingDiscTimeRestriction
2519        }
2520        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kWeight => TrafficSignType::Weight,
2521        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kWet => TrafficSignType::Wet,
2522        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kParkingConstraint => {
2523            TrafficSignType::ParkingConstraint
2524        }
2525        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoWaitingSideStripes => {
2526            TrafficSignType::NoWaitingSideStripes
2527        }
2528        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRain => TrafficSignType::Rain,
2529        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSnowRain => TrafficSignType::SnowRain,
2530        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNight => TrafficSignType::Night,
2531        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kStop4Way => TrafficSignType::Stop4Way,
2532        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTruck => TrafficSignType::Truck,
2533        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTractorsMayBePassed => {
2534            TrafficSignType::TractorsMayBePassed
2535        }
2536        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHazardous => TrafficSignType::Hazardous,
2537        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTrailer => TrafficSignType::Trailer,
2538        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kZone => TrafficSignType::Zone,
2539        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMotorcycle => TrafficSignType::Motorcycle,
2540        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMotorcycleAllowed => {
2541            TrafficSignType::MotorcycleAllowed
2542        }
2543        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCar => TrafficSignType::Car,
2544        maliput_sys::api::rules::ffi::TrafficControlDeviceType::kEmergencyLane => TrafficSignType::EmergencyLane,
2545        _ => TrafficSignType::Unknown,
2546    }
2547}
2548
2549pub(crate) fn traffic_control_device_type_to_cpp(
2550    sign_type: &TrafficControlDeviceType,
2551) -> maliput_sys::api::rules::ffi::TrafficControlDeviceType {
2552    match sign_type {
2553        TrafficSignType::None => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNone,
2554        TrafficSignType::Other => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOther,
2555        TrafficSignType::Stop => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kStop,
2556        TrafficSignType::Yield => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kYield,
2557        TrafficSignType::SpeedLimit => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSpeedLimit,
2558        TrafficSignType::NoEntry => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoEntry,
2559        TrafficSignType::OneWay => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOneWay,
2560        TrafficSignType::PedestrianCrossing => {
2561            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPedestrianCrossing
2562        }
2563        TrafficSignType::NoLeftTurn => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoLeftTurn,
2564        TrafficSignType::NoRightTurn => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoRightTurn,
2565        TrafficSignType::NoUTurn => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoUTurn,
2566        TrafficSignType::SchoolZone => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSchoolZone,
2567        TrafficSignType::Construction => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kConstruction,
2568        TrafficSignType::RailroadCrossing => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRailroadCrossing,
2569        TrafficSignType::NoOvertaking => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoOvertaking,
2570        TrafficSignType::AllWay => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAllWay,
2571        TrafficSignType::NoUTurnLeft => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoUTurnLeft,
2572        TrafficSignType::NoUTurnRight => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoUTurnRight,
2573        TrafficSignType::StopLine => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kStopLine,
2574        TrafficSignType::Crosswalk => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCrosswalk,
2575        TrafficSignType::DangerSpot => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDangerSpot,
2576        TrafficSignType::ZebraCrossing => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kZebraCrossing,
2577        TrafficSignType::Flight => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kFlight,
2578        TrafficSignType::Cattle => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCattle,
2579        TrafficSignType::HorseRiders => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHorseRiders,
2580        TrafficSignType::Amphibians => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAmphibians,
2581        TrafficSignType::FallingRocks => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kFallingRocks,
2582        TrafficSignType::SnowOrIce => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSnowOrIce,
2583        TrafficSignType::LooseGravel => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kLooseGravel,
2584        TrafficSignType::Waterside => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kWaterside,
2585        TrafficSignType::Clearance => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kClearance,
2586        TrafficSignType::MovableBridge => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMovableBridge,
2587        TrafficSignType::RightBeforeLeftNextIntersection => {
2588            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRightBeforeLeftNextIntersection
2589        }
2590        TrafficSignType::TurnLeft => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTurnLeft,
2591        TrafficSignType::TurnRight => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTurnRight,
2592        TrafficSignType::DoubleTurnLeft => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDoubleTurnLeft,
2593        TrafficSignType::DoubleTurnRight => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDoubleTurnRight,
2594        TrafficSignType::HillDownwards => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHillDownwards,
2595        TrafficSignType::HillUpwards => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHillUpwards,
2596        TrafficSignType::UnevenRoad => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kUnevenRoad,
2597        TrafficSignType::RoadSlipperyWetOrDirty => {
2598            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRoadSlipperyWetOrDirty
2599        }
2600        TrafficSignType::SideWinds => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSideWinds,
2601        TrafficSignType::RoadNarrowing => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRoadNarrowing,
2602        TrafficSignType::RoadNarrowingRight => {
2603            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRoadNarrowingRight
2604        }
2605        TrafficSignType::RoadNarrowingLeft => {
2606            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRoadNarrowingLeft
2607        }
2608        TrafficSignType::RoadWorks => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRoadWorks,
2609        TrafficSignType::TrafficQueues => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTrafficQueues,
2610        TrafficSignType::TwoWayTraffic => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTwoWayTraffic,
2611        TrafficSignType::AttentionTrafficLight => {
2612            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAttentionTrafficLight
2613        }
2614        TrafficSignType::Pedestrians => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPedestrians,
2615        TrafficSignType::ChildrenCrossing => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kChildrenCrossing,
2616        TrafficSignType::CycleRoute => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCycleRoute,
2617        TrafficSignType::DeerCrossing => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDeerCrossing,
2618        TrafficSignType::UngatedLevelCrossing => {
2619            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kUngatedLevelCrossing
2620        }
2621        TrafficSignType::LevelCrossingMarker => {
2622            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kLevelCrossingMarker
2623        }
2624        TrafficSignType::RailwayTrafficPriority => {
2625            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRailwayTrafficPriority
2626        }
2627        TrafficSignType::GiveWay => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kGiveWay,
2628        TrafficSignType::PriorityToOppositeDirection => {
2629            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityToOppositeDirection
2630        }
2631        TrafficSignType::PriorityToOppositeDirectionUpsideDown => {
2632            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityToOppositeDirectionUpsideDown
2633        }
2634        TrafficSignType::PrescribedLeftTurn => {
2635            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedLeftTurn
2636        }
2637        TrafficSignType::PrescribedRightTurn => {
2638            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedRightTurn
2639        }
2640        TrafficSignType::PrescribedStraight => {
2641            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedStraight
2642        }
2643        TrafficSignType::PrescribedRightWay => {
2644            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedRightWay
2645        }
2646        TrafficSignType::PrescribedLeftWay => {
2647            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedLeftWay
2648        }
2649        TrafficSignType::PrescribedRightTurnAndStraight => {
2650            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedRightTurnAndStraight
2651        }
2652        TrafficSignType::PrescribedLeftTurnAndStraight => {
2653            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedLeftTurnAndStraight
2654        }
2655        TrafficSignType::PrescribedLeftTurnAndRightTurn => {
2656            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedLeftTurnAndRightTurn
2657        }
2658        TrafficSignType::PrescribedLeftTurnRightTurnAndStraight => {
2659            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedLeftTurnRightTurnAndStraight
2660        }
2661        TrafficSignType::Roundabout => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRoundabout,
2662        TrafficSignType::OnewayLeft => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOnewayLeft,
2663        TrafficSignType::OnewayRight => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOnewayRight,
2664        TrafficSignType::PassLeft => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPassLeft,
2665        TrafficSignType::PassRight => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPassRight,
2666        TrafficSignType::SideLaneOpenForTraffic => {
2667            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSideLaneOpenForTraffic
2668        }
2669        TrafficSignType::SideLaneClosedForTraffic => {
2670            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSideLaneClosedForTraffic
2671        }
2672        TrafficSignType::SideLaneClosingForTraffic => {
2673            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSideLaneClosingForTraffic
2674        }
2675        TrafficSignType::BusStop => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBusStop,
2676        TrafficSignType::TaxiStand => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTaxiStand,
2677        TrafficSignType::BicyclesOnly => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBicyclesOnly,
2678        TrafficSignType::HorseRidersOnly => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHorseRidersOnly,
2679        TrafficSignType::PedestriansOnly => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPedestriansOnly,
2680        TrafficSignType::BicyclesPedestriansSharedOnly => {
2681            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBicyclesPedestriansSharedOnly
2682        }
2683        TrafficSignType::BicyclesPedestriansSeparatedLeftOnly => {
2684            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBicyclesPedestriansSeparatedLeftOnly
2685        }
2686        TrafficSignType::BicyclesPedestriansSeparatedRightOnly => {
2687            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBicyclesPedestriansSeparatedRightOnly
2688        }
2689        TrafficSignType::PedestrianZoneBegin => {
2690            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPedestrianZoneBegin
2691        }
2692        TrafficSignType::PedestrianZoneEnd => {
2693            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPedestrianZoneEnd
2694        }
2695        TrafficSignType::BicycleRoadBegin => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBicycleRoadBegin,
2696        TrafficSignType::BicycleRoadEnd => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBicycleRoadEnd,
2697        TrafficSignType::BusLane => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBusLane,
2698        TrafficSignType::BusLaneBegin => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBusLaneBegin,
2699        TrafficSignType::BusLaneEnd => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBusLaneEnd,
2700        TrafficSignType::AllProhibited => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAllProhibited,
2701        TrafficSignType::MotorizedMultitrackProhibited => {
2702            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMotorizedMultitrackProhibited
2703        }
2704        TrafficSignType::TrucksProhibited => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTrucksProhibited,
2705        TrafficSignType::BicyclesProhibited => {
2706            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBicyclesProhibited
2707        }
2708        TrafficSignType::MotorcyclesProhibited => {
2709            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMotorcyclesProhibited
2710        }
2711        TrafficSignType::MopedsProhibited => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMopedsProhibited,
2712        TrafficSignType::HorseRidersProhibited => {
2713            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHorseRidersProhibited
2714        }
2715        TrafficSignType::HorseCarriagesProhibited => {
2716            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHorseCarriagesProhibited
2717        }
2718        TrafficSignType::CattleProhibited => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCattleProhibited,
2719        TrafficSignType::BusesProhibited => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kBusesProhibited,
2720        TrafficSignType::CarsProhibited => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCarsProhibited,
2721        TrafficSignType::CarsTrailersProhibited => {
2722            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCarsTrailersProhibited
2723        }
2724        TrafficSignType::TrucksTrailersProhibited => {
2725            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTrucksTrailersProhibited
2726        }
2727        TrafficSignType::TractorsProhibited => {
2728            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTractorsProhibited
2729        }
2730        TrafficSignType::PedestriansProhibited => {
2731            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPedestriansProhibited
2732        }
2733        TrafficSignType::MotorVehiclesProhibited => {
2734            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMotorVehiclesProhibited
2735        }
2736        TrafficSignType::HazardousGoodsVehiclesProhibited => {
2737            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHazardousGoodsVehiclesProhibited
2738        }
2739        TrafficSignType::OverWeightVehiclesProhibited => {
2740            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOverWeightVehiclesProhibited
2741        }
2742        TrafficSignType::VehiclesAxleOverWeightProhibited => {
2743            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kVehiclesAxleOverWeightProhibited
2744        }
2745        TrafficSignType::VehiclesExcessWidthProhibited => {
2746            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kVehiclesExcessWidthProhibited
2747        }
2748        TrafficSignType::VehiclesExcessHeightProhibited => {
2749            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kVehiclesExcessHeightProhibited
2750        }
2751        TrafficSignType::VehiclesExcessLengthProhibited => {
2752            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kVehiclesExcessLengthProhibited
2753        }
2754        TrafficSignType::DoNotEnter => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDoNotEnter,
2755        TrafficSignType::SnowChainsRequired => {
2756            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSnowChainsRequired
2757        }
2758        TrafficSignType::WaterPollutantVehiclesProhibited => {
2759            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kWaterPollutantVehiclesProhibited
2760        }
2761        TrafficSignType::EnvironmentalZoneBegin => {
2762            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kEnvironmentalZoneBegin
2763        }
2764        TrafficSignType::EnvironmentalZoneEnd => {
2765            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kEnvironmentalZoneEnd
2766        }
2767        TrafficSignType::PrescribedUTurnLeft => {
2768            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedUTurnLeft
2769        }
2770        TrafficSignType::PrescribedUTurnRight => {
2771            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrescribedUTurnRight
2772        }
2773        TrafficSignType::MinimumDistanceForTrucks => {
2774            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMinimumDistanceForTrucks
2775        }
2776        TrafficSignType::SpeedLimitBegin => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSpeedLimitBegin,
2777        TrafficSignType::SpeedLimitZoneBegin => {
2778            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSpeedLimitZoneBegin
2779        }
2780        TrafficSignType::SpeedLimitZoneEnd => {
2781            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSpeedLimitZoneEnd
2782        }
2783        TrafficSignType::MinimumSpeedBegin => {
2784            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMinimumSpeedBegin
2785        }
2786        TrafficSignType::OvertakingBanBegin => {
2787            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOvertakingBanBegin
2788        }
2789        TrafficSignType::OvertakingBanForTrucksBegin => {
2790            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOvertakingBanForTrucksBegin
2791        }
2792        TrafficSignType::SpeedLimitEnd => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSpeedLimitEnd,
2793        TrafficSignType::MinimumSpeedEnd => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMinimumSpeedEnd,
2794        TrafficSignType::OvertakingBanEnd => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOvertakingBanEnd,
2795        TrafficSignType::OvertakingBanForTrucksEnd => {
2796            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOvertakingBanForTrucksEnd
2797        }
2798        TrafficSignType::AllRestrictionsEnd => {
2799            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAllRestrictionsEnd
2800        }
2801        TrafficSignType::NoStopping => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoStopping,
2802        TrafficSignType::NoParking => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoParking,
2803        TrafficSignType::NoParkingZoneBegin => {
2804            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoParkingZoneBegin
2805        }
2806        TrafficSignType::NoParkingZoneEnd => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoParkingZoneEnd,
2807        TrafficSignType::RightOfWayNextIntersection => {
2808            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRightOfWayNextIntersection
2809        }
2810        TrafficSignType::RightOfWayBegin => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRightOfWayBegin,
2811        TrafficSignType::RightOfWayEnd => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRightOfWayEnd,
2812        TrafficSignType::PriorityOverOppositeDirection => {
2813            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityOverOppositeDirection
2814        }
2815        TrafficSignType::PriorityOverOppositeDirectionUpsideDown => {
2816            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityOverOppositeDirectionUpsideDown
2817        }
2818        TrafficSignType::TownBegin => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTownBegin,
2819        TrafficSignType::TownEnd => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTownEnd,
2820        TrafficSignType::CarParking => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCarParking,
2821        TrafficSignType::CarParkingZoneBegin => {
2822            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCarParkingZoneBegin
2823        }
2824        TrafficSignType::CarParkingZoneEnd => {
2825            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCarParkingZoneEnd
2826        }
2827        TrafficSignType::SidewalkHalfParkingLeft => {
2828            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSidewalkHalfParkingLeft
2829        }
2830        TrafficSignType::SidewalkHalfParkingRight => {
2831            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSidewalkHalfParkingRight
2832        }
2833        TrafficSignType::SidewalkParkingLeft => {
2834            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSidewalkParkingLeft
2835        }
2836        TrafficSignType::SidewalkParkingRight => {
2837            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSidewalkParkingRight
2838        }
2839        TrafficSignType::SidewalkPerpendicularHalfParkingLeft => {
2840            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSidewalkPerpendicularHalfParkingLeft
2841        }
2842        TrafficSignType::SidewalkPerpendicularHalfParkingRight => {
2843            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSidewalkPerpendicularHalfParkingRight
2844        }
2845        TrafficSignType::SidewalkPerpendicularParkingLeft => {
2846            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSidewalkPerpendicularParkingLeft
2847        }
2848        TrafficSignType::SidewalkPerpendicularParkingRight => {
2849            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSidewalkPerpendicularParkingRight
2850        }
2851        TrafficSignType::LivingStreetBegin => {
2852            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kLivingStreetBegin
2853        }
2854        TrafficSignType::LivingStreetEnd => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kLivingStreetEnd,
2855        TrafficSignType::Tunnel => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTunnel,
2856        TrafficSignType::EmergencyStoppingLeft => {
2857            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kEmergencyStoppingLeft
2858        }
2859        TrafficSignType::EmergencyStoppingRight => {
2860            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kEmergencyStoppingRight
2861        }
2862        TrafficSignType::HighwayBegin => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayBegin,
2863        TrafficSignType::HighwayEnd => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayEnd,
2864        TrafficSignType::ExpresswayBegin => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kExpresswayBegin,
2865        TrafficSignType::ExpresswayEnd => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kExpresswayEnd,
2866        TrafficSignType::NamedHighwayExit => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNamedHighwayExit,
2867        TrafficSignType::NamedExpresswayExit => {
2868            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNamedExpresswayExit
2869        }
2870        TrafficSignType::NamedRoadExit => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNamedRoadExit,
2871        TrafficSignType::HighwayExit => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayExit,
2872        TrafficSignType::ExpresswayExit => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kExpresswayExit,
2873        TrafficSignType::OnewayStreet => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOnewayStreet,
2874        TrafficSignType::CrossingGuards => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCrossingGuards,
2875        TrafficSignType::Deadend => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDeadend,
2876        TrafficSignType::DeadendExcludingDesignatedActors => {
2877            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDeadendExcludingDesignatedActors
2878        }
2879        TrafficSignType::FirstAidStation => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kFirstAidStation,
2880        TrafficSignType::PoliceStation => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPoliceStation,
2881        TrafficSignType::Telephone => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTelephone,
2882        TrafficSignType::FillingStation => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kFillingStation,
2883        TrafficSignType::Hotel => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHotel,
2884        TrafficSignType::Inn => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kInn,
2885        TrafficSignType::Kiosk => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kKiosk,
2886        TrafficSignType::Toilet => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kToilet,
2887        TrafficSignType::Chapel => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kChapel,
2888        TrafficSignType::TouristInfo => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTouristInfo,
2889        TrafficSignType::RepairService => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRepairService,
2890        TrafficSignType::PedestrianUnderpass => {
2891            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPedestrianUnderpass
2892        }
2893        TrafficSignType::PedestrianBridge => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPedestrianBridge,
2894        TrafficSignType::CamperPlace => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCamperPlace,
2895        TrafficSignType::AdvisorySpeedLimitBegin => {
2896            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAdvisorySpeedLimitBegin
2897        }
2898        TrafficSignType::AdvisorySpeedLimitEnd => {
2899            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAdvisorySpeedLimitEnd
2900        }
2901        TrafficSignType::PlaceName => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPlaceName,
2902        TrafficSignType::TouristAttraction => {
2903            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTouristAttraction
2904        }
2905        TrafficSignType::TouristRoute => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTouristRoute,
2906        TrafficSignType::TouristArea => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTouristArea,
2907        TrafficSignType::ShoulderNotPassableMotorVehicles => {
2908            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kShoulderNotPassableMotorVehicles
2909        }
2910        TrafficSignType::ShoulderUnsafeTrucksTractors => {
2911            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kShoulderUnsafeTrucksTractors
2912        }
2913        TrafficSignType::TollBegin => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTollBegin,
2914        TrafficSignType::TollEnd => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTollEnd,
2915        TrafficSignType::TollRoad => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTollRoad,
2916        TrafficSignType::Customs => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCustoms,
2917        TrafficSignType::InternationalBorderInfo => {
2918            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kInternationalBorderInfo
2919        }
2920        TrafficSignType::StreetlightRedBand => {
2921            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kStreetlightRedBand
2922        }
2923        TrafficSignType::FederalHighwayRouteNumber => {
2924            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kFederalHighwayRouteNumber
2925        }
2926        TrafficSignType::HighwayRouteNumber => {
2927            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayRouteNumber
2928        }
2929        TrafficSignType::HighwayInterchangeNumber => {
2930            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayInterchangeNumber
2931        }
2932        TrafficSignType::EuropeanRouteNumber => {
2933            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kEuropeanRouteNumber
2934        }
2935        TrafficSignType::FederalHighwayDirectionLeft => {
2936            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kFederalHighwayDirectionLeft
2937        }
2938        TrafficSignType::FederalHighwayDirectionRight => {
2939            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kFederalHighwayDirectionRight
2940        }
2941        TrafficSignType::PrimaryRoadDirectionLeft => {
2942            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrimaryRoadDirectionLeft
2943        }
2944        TrafficSignType::PrimaryRoadDirectionRight => {
2945            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPrimaryRoadDirectionRight
2946        }
2947        TrafficSignType::SecondaryRoadDirectionLeft => {
2948            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSecondaryRoadDirectionLeft
2949        }
2950        TrafficSignType::SecondaryRoadDirectionRight => {
2951            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSecondaryRoadDirectionRight
2952        }
2953        TrafficSignType::DirectionDesignatedActorsLeft => {
2954            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionDesignatedActorsLeft
2955        }
2956        TrafficSignType::DirectionDesignatedActorsRight => {
2957            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionDesignatedActorsRight
2958        }
2959        TrafficSignType::RoutingDesignatedActors => {
2960            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRoutingDesignatedActors
2961        }
2962        TrafficSignType::DirectionToHighwayLeft => {
2963            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionToHighwayLeft
2964        }
2965        TrafficSignType::DirectionToHighwayRight => {
2966            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionToHighwayRight
2967        }
2968        TrafficSignType::DirectionToLocalDestinationLeft => {
2969            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionToLocalDestinationLeft
2970        }
2971        TrafficSignType::DirectionToLocalDestinationRight => {
2972            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionToLocalDestinationRight
2973        }
2974        TrafficSignType::ConsolidatedDirections => {
2975            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kConsolidatedDirections
2976        }
2977        TrafficSignType::StreetName => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kStreetName,
2978        TrafficSignType::DirectionPreannouncement => {
2979            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionPreannouncement
2980        }
2981        TrafficSignType::DirectionPreannouncementLaneConfig => {
2982            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionPreannouncementLaneConfig
2983        }
2984        TrafficSignType::DirectionPreannouncementHighwayEntries => {
2985            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionPreannouncementHighwayEntries
2986        }
2987        TrafficSignType::HighwayAnnouncement => {
2988            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayAnnouncement
2989        }
2990        TrafficSignType::OtherRoadAnnouncement => {
2991            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOtherRoadAnnouncement
2992        }
2993        TrafficSignType::HighwayAnnouncementTruckStop => {
2994            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayAnnouncementTruckStop
2995        }
2996        TrafficSignType::HighwayPreannouncementDirections => {
2997            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayPreannouncementDirections
2998        }
2999        TrafficSignType::PoleExit => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPoleExit,
3000        TrafficSignType::HighwayDistanceBoard => {
3001            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHighwayDistanceBoard
3002        }
3003        TrafficSignType::DetourLeft => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDetourLeft,
3004        TrafficSignType::DetourRight => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDetourRight,
3005        TrafficSignType::NumberedDetour => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNumberedDetour,
3006        TrafficSignType::DetourBegin => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDetourBegin,
3007        TrafficSignType::DetourEnd => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDetourEnd,
3008        TrafficSignType::DetourRoutingBoard => {
3009            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDetourRoutingBoard
3010        }
3011        TrafficSignType::OptionalDetour => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOptionalDetour,
3012        TrafficSignType::OptionalDetourRouting => {
3013            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kOptionalDetourRouting
3014        }
3015        TrafficSignType::RouteRecommendation => {
3016            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRouteRecommendation
3017        }
3018        TrafficSignType::RouteRecommendationEnd => {
3019            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRouteRecommendationEnd
3020        }
3021        TrafficSignType::AnnounceLaneTransitionLeft => {
3022            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAnnounceLaneTransitionLeft
3023        }
3024        TrafficSignType::AnnounceLaneTransitionRight => {
3025            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAnnounceLaneTransitionRight
3026        }
3027        TrafficSignType::AnnounceRightLaneEnd => {
3028            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAnnounceRightLaneEnd
3029        }
3030        TrafficSignType::AnnounceLeftLaneEnd => {
3031            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAnnounceLeftLaneEnd
3032        }
3033        TrafficSignType::AnnounceRightLaneBegin => {
3034            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAnnounceRightLaneBegin
3035        }
3036        TrafficSignType::AnnounceLeftLaneBegin => {
3037            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAnnounceLeftLaneBegin
3038        }
3039        TrafficSignType::AnnounceLaneConsolidation => {
3040            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAnnounceLaneConsolidation
3041        }
3042        TrafficSignType::DetourCityBlock => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDetourCityBlock,
3043        TrafficSignType::Gate => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kGate,
3044        TrafficSignType::PoleWarning => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPoleWarning,
3045        TrafficSignType::TrafficCone => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTrafficCone,
3046        TrafficSignType::MobileLaneClosure => {
3047            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMobileLaneClosure
3048        }
3049        TrafficSignType::ReflectorPost => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kReflectorPost,
3050        TrafficSignType::DirectionalBoardWarning => {
3051            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kDirectionalBoardWarning
3052        }
3053        TrafficSignType::GuidingPlate => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kGuidingPlate,
3054        TrafficSignType::GuidingPlateWedges => {
3055            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kGuidingPlateWedges
3056        }
3057        TrafficSignType::ParkingHazard => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kParkingHazard,
3058        TrafficSignType::TrafficLightGreenArrow => {
3059            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTrafficLightGreenArrow
3060        }
3061        TrafficSignType::Text => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kText,
3062        TrafficSignType::Space => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSpace,
3063        TrafficSignType::Time => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTime,
3064        TrafficSignType::Arrow => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kArrow,
3065        TrafficSignType::ConstrainedTo => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kConstrainedTo,
3066        TrafficSignType::Except => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kExcept,
3067        TrafficSignType::ValidForDistance => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kValidForDistance,
3068        TrafficSignType::PriorityRoadBottomLeftFourWay => {
3069            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadBottomLeftFourWay
3070        }
3071        TrafficSignType::PriorityRoadTopLeftFourWay => {
3072            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadTopLeftFourWay
3073        }
3074        TrafficSignType::PriorityRoadBottomLeftThreeWayStraight => {
3075            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadBottomLeftThreeWayStraight
3076        }
3077        TrafficSignType::PriorityRoadBottomLeftThreeWaySideways => {
3078            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadBottomLeftThreeWaySideways
3079        }
3080        TrafficSignType::PriorityRoadTopLeftThreeWayStraight => {
3081            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadTopLeftThreeWayStraight
3082        }
3083        TrafficSignType::PriorityRoadBottomRightFourWay => {
3084            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadBottomRightFourWay
3085        }
3086        TrafficSignType::PriorityRoadTopRightFourWay => {
3087            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadTopRightFourWay
3088        }
3089        TrafficSignType::PriorityRoadBottomRightThreeWayStraight => {
3090            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadBottomRightThreeWayStraight
3091        }
3092        TrafficSignType::PriorityRoadBottomRightThreeWaySideway => {
3093            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadBottomRightThreeWaySideway
3094        }
3095        TrafficSignType::PriorityRoadTopRightThreeWayStraight => {
3096            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kPriorityRoadTopRightThreeWayStraight
3097        }
3098        TrafficSignType::ValidInDistance => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kValidInDistance,
3099        TrafficSignType::StopIn => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kStopIn,
3100        TrafficSignType::LeftArrow => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kLeftArrow,
3101        TrafficSignType::LeftBendArrow => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kLeftBendArrow,
3102        TrafficSignType::RightArrow => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRightArrow,
3103        TrafficSignType::RightBendArrow => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRightBendArrow,
3104        TrafficSignType::Accident => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kAccident,
3105        TrafficSignType::Snow => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSnow,
3106        TrafficSignType::Fog => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kFog,
3107        TrafficSignType::RollingHighwayInformation => {
3108            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRollingHighwayInformation
3109        }
3110        TrafficSignType::Services => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kServices,
3111        TrafficSignType::TimeRange => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTimeRange,
3112        TrafficSignType::ParkingDiscTimeRestriction => {
3113            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kParkingDiscTimeRestriction
3114        }
3115        TrafficSignType::Weight => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kWeight,
3116        TrafficSignType::Wet => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kWet,
3117        TrafficSignType::ParkingConstraint => {
3118            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kParkingConstraint
3119        }
3120        TrafficSignType::NoWaitingSideStripes => {
3121            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNoWaitingSideStripes
3122        }
3123        TrafficSignType::Rain => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kRain,
3124        TrafficSignType::SnowRain => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kSnowRain,
3125        TrafficSignType::Night => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kNight,
3126        TrafficSignType::Stop4Way => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kStop4Way,
3127        TrafficSignType::Truck => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTruck,
3128        TrafficSignType::TractorsMayBePassed => {
3129            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTractorsMayBePassed
3130        }
3131        TrafficSignType::Hazardous => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kHazardous,
3132        TrafficSignType::Trailer => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kTrailer,
3133        TrafficSignType::Zone => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kZone,
3134        TrafficSignType::Motorcycle => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMotorcycle,
3135        TrafficSignType::MotorcycleAllowed => {
3136            maliput_sys::api::rules::ffi::TrafficControlDeviceType::kMotorcycleAllowed
3137        }
3138        TrafficSignType::Car => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kCar,
3139        TrafficSignType::EmergencyLane => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kEmergencyLane,
3140        TrafficSignType::Unknown => maliput_sys::api::rules::ffi::TrafficControlDeviceType::kUnknown,
3141    }
3142}
3143
3144fn traffic_sign_value_unit_from_cpp(unit: &maliput_sys::api::rules::ffi::TrafficSignValueUnit) -> TrafficSignValueUnit {
3145    match *unit {
3146        maliput_sys::api::rules::ffi::TrafficSignValueUnit::kMetersPerSecond => TrafficSignValueUnit::MetersPerSecond,
3147        maliput_sys::api::rules::ffi::TrafficSignValueUnit::kKilometersPerHour => {
3148            TrafficSignValueUnit::KilometersPerHour
3149        }
3150        maliput_sys::api::rules::ffi::TrafficSignValueUnit::kMilesPerHour => TrafficSignValueUnit::MilesPerHour,
3151        maliput_sys::api::rules::ffi::TrafficSignValueUnit::kMeters => TrafficSignValueUnit::Meters,
3152        maliput_sys::api::rules::ffi::TrafficSignValueUnit::kKilometers => TrafficSignValueUnit::Kilometers,
3153        maliput_sys::api::rules::ffi::TrafficSignValueUnit::kFeet => TrafficSignValueUnit::Feet,
3154        maliput_sys::api::rules::ffi::TrafficSignValueUnit::kMiles => TrafficSignValueUnit::Miles,
3155        maliput_sys::api::rules::ffi::TrafficSignValueUnit::kPercent => TrafficSignValueUnit::Percent,
3156        maliput_sys::api::rules::ffi::TrafficSignValueUnit::kKilograms => TrafficSignValueUnit::Kilograms,
3157        maliput_sys::api::rules::ffi::TrafficSignValueUnit::kMetricTons => TrafficSignValueUnit::MetricTons,
3158        _ => panic!("Invalid traffic sign value unit"),
3159    }
3160}
3161
3162/// Interface for accessing the [TrafficSign]s in the [super::RoadNetwork].
3163pub struct TrafficSignBook<'a> {
3164    pub(super) traffic_sign_book: &'a maliput_sys::api::rules::ffi::TrafficSignBook,
3165}
3166
3167impl<'a> TrafficSignBook<'a> {
3168    /// Gets all the [TrafficSign]s in the [TrafficSignBook].
3169    ///
3170    /// # Returns
3171    /// A vector of [TrafficSign]s.
3172    pub fn traffic_signs(&self) -> Vec<TrafficSign<'_>> {
3173        let traffic_signs_cpp = maliput_sys::api::rules::ffi::TrafficSignBook_TrafficSigns(self.traffic_sign_book);
3174        traffic_signs_cpp
3175            .into_iter()
3176            .map(|ts| TrafficSign {
3177                traffic_sign: unsafe { ts.traffic_sign.as_ref().expect("TrafficSign pointer is null") },
3178            })
3179            .collect::<Vec<TrafficSign>>()
3180    }
3181
3182    /// Gets a [TrafficSign] by its id.
3183    ///
3184    /// # Arguments
3185    /// * `id` - The id of the [TrafficSign].
3186    ///
3187    /// # Returns
3188    /// The [TrafficSign] with the given id, or `None` if not found.
3189    pub fn get_traffic_sign(&self, id: &String) -> Option<TrafficSign<'_>> {
3190        let ptr = maliput_sys::api::rules::ffi::TrafficSignBook_GetTrafficSign(self.traffic_sign_book, id);
3191        if ptr.is_null() {
3192            return None;
3193        }
3194        Some(TrafficSign {
3195            traffic_sign: unsafe { ptr.as_ref().expect("Unable to get underlying traffic sign pointer") },
3196        })
3197    }
3198
3199    /// Gets all [TrafficSign]s whose `related_lanes()` includes the given lane ID.
3200    ///
3201    /// # Arguments
3202    /// * `lane_id` - The lane ID to filter by.
3203    ///
3204    /// # Returns
3205    /// A vector of [TrafficSign]s associated with the given lane.
3206    pub fn find_by_lane(&self, lane_id: &String) -> Vec<TrafficSign<'_>> {
3207        let traffic_signs_cpp =
3208            maliput_sys::api::rules::ffi::TrafficSignBook_FindByLane(self.traffic_sign_book, lane_id);
3209        traffic_signs_cpp
3210            .into_iter()
3211            .map(|ts| TrafficSign {
3212                traffic_sign: unsafe { ts.traffic_sign.as_ref().expect("TrafficSign pointer is null") },
3213            })
3214            .collect::<Vec<TrafficSign>>()
3215    }
3216
3217    /// Gets all [TrafficSign]s of the given [TrafficSignType].
3218    ///
3219    /// # Arguments
3220    /// * `sign_type` - The [TrafficSignType] to filter by.
3221    ///
3222    /// # Returns
3223    /// A vector of [TrafficSign]s of the given type.
3224    pub fn find_by_type(&self, sign_type: &TrafficSignType) -> Vec<TrafficSign<'_>> {
3225        let sign_type_ffi = traffic_control_device_type_to_cpp(sign_type);
3226        let traffic_signs_cpp =
3227            maliput_sys::api::rules::ffi::TrafficSignBook_FindByType(self.traffic_sign_book, sign_type_ffi);
3228        traffic_signs_cpp
3229            .into_iter()
3230            .map(|ts| TrafficSign {
3231                traffic_sign: unsafe { ts.traffic_sign.as_ref().expect("TrafficSign pointer is null") },
3232            })
3233            .collect::<Vec<TrafficSign>>()
3234    }
3235}
3236
3237/// Models a physical traffic sign — a static, passive signaling device placed
3238/// along or above the road to convey regulatory, warning, or informational
3239/// messages to road users.
3240///
3241/// Unlike [TrafficLight], traffic signs do not expose phase-based bulb states.
3242/// A sign may still be marked as dynamic or movable by backend metadata.
3243pub struct TrafficSign<'a> {
3244    pub traffic_sign: &'a maliput_sys::api::rules::ffi::TrafficSign,
3245}
3246
3247impl<'a> TrafficSign<'a> {
3248    /// Gets the unique identifier of the [TrafficSign].
3249    ///
3250    /// # Returns
3251    /// The id of the [TrafficSign].
3252    pub fn id(&self) -> String {
3253        maliput_sys::api::rules::ffi::TrafficSign_id(self.traffic_sign)
3254    }
3255
3256    /// Gets the [TrafficSignType] of the [TrafficSign].
3257    ///
3258    /// # Returns
3259    /// The [TrafficSignType].
3260    pub fn sign_type(&self) -> TrafficSignType {
3261        let sign_type = maliput_sys::api::rules::ffi::TrafficSign_type(self.traffic_sign);
3262        traffic_control_device_type_from_cpp(&sign_type)
3263    }
3264
3265    /// Gets the position of the [TrafficSign] in the road network's Inertial frame.
3266    ///
3267    /// # Returns
3268    /// An [super::InertialPosition] representing the position of the [TrafficSign].
3269    pub fn position_road_network(&self) -> super::InertialPosition {
3270        let inertial_position = maliput_sys::api::rules::ffi::TrafficSign_position_road_network(self.traffic_sign);
3271        super::InertialPosition { ip: inertial_position }
3272    }
3273
3274    /// Gets the orientation of the [TrafficSign] in the road network's Inertial frame.
3275    ///
3276    /// # Returns
3277    /// An [super::Rotation] representing the orientation of the [TrafficSign].
3278    pub fn orientation_road_network(&self) -> super::Rotation {
3279        let rotation = maliput_sys::api::rules::ffi::TrafficSign_orientation_road_network(self.traffic_sign);
3280        super::Rotation { r: rotation }
3281    }
3282
3283    /// Gets the optional text message displayed on the [TrafficSign].
3284    ///
3285    /// # Returns
3286    /// `Some(String)` if a message is set, `None` otherwise.
3287    pub fn message(&self) -> Option<String> {
3288        let wrapper = maliput_sys::api::rules::ffi::TrafficSign_message(self.traffic_sign);
3289        if wrapper.is_null() {
3290            return None;
3291        }
3292        Some(wrapper.value.clone())
3293    }
3294
3295    /// Returns whether this sign can change semantically over time.
3296    pub fn is_dynamic(&self) -> bool {
3297        maliput_sys::api::rules::ffi::TrafficSign::is_dynamic(self.traffic_sign)
3298    }
3299
3300    /// Returns whether this sign's position can change.
3301    pub fn is_movable(&self) -> bool {
3302        maliput_sys::api::rules::ffi::TrafficSign::is_movable(self.traffic_sign)
3303    }
3304
3305    /// Gets the lane IDs that this sign is physically relevant to.
3306    ///
3307    /// # Returns
3308    /// A vector of lane ID strings.
3309    pub fn related_lanes(&self) -> Vec<String> {
3310        maliput_sys::api::rules::ffi::TrafficSign_related_lanes(self.traffic_sign)
3311    }
3312
3313    /// Gets the bounding box of the [TrafficSign].
3314    ///
3315    /// # Returns
3316    /// A [crate::math::BoundingBox] describing the sign's oriented bounding volume.
3317    /// The box position is the centroid, `box_size` gives full extents, and `orientation`
3318    /// is expressed as roll-pitch-yaw angles.
3319    pub fn bounding_box(&self) -> crate::math::BoundingBox {
3320        let b = maliput_sys::api::rules::ffi::TrafficSign_bounding_box(self.traffic_sign);
3321        crate::math::BoundingBox { b }
3322    }
3323
3324    /// Gets the optional numeric value associated with the [TrafficSign].
3325    ///
3326    /// # Returns
3327    /// `Some(TrafficSignValue)` if a value is set, `None` otherwise.
3328    pub fn value(&self) -> Option<TrafficSignValue> {
3329        let data = maliput_sys::api::rules::ffi::TrafficSign_value(self.traffic_sign);
3330        if !data.has_value {
3331            return None;
3332        }
3333        Some(TrafficSignValue {
3334            value: data.value,
3335            unit: traffic_sign_value_unit_from_cpp(&data.unit),
3336        })
3337    }
3338
3339    /// Returns backend-specific key-value properties for this [TrafficSign].
3340    pub fn properties(&self) -> HashMap<String, String> {
3341        maliput_sys::api::rules::ffi::TrafficSign_properties(self.traffic_sign)
3342            .into_iter()
3343            .map(|p| (p.key, p.value))
3344            .collect()
3345    }
3346
3347    /// Returns the [TrafficSign]s' IDs that depend on this sign, if any.
3348    /// For example, a "Stop" sign may have an associated "All way" sign.
3349    pub fn dependent_signs(&self) -> Vec<String> {
3350        maliput_sys::api::rules::ffi::TrafficSign_dependent_signs(self.traffic_sign)
3351    }
3352}
3353
3354#[cfg(test)]
3355mod tests {
3356    use super::*;
3357
3358    #[test]
3359    fn traffic_sign_type_roundtrips_all_known_variants() {
3360        let variants = [
3361            TrafficSignType::None,
3362            TrafficSignType::Other,
3363            TrafficSignType::Stop,
3364            TrafficSignType::Yield,
3365            TrafficSignType::SpeedLimit,
3366            TrafficSignType::NoEntry,
3367            TrafficSignType::OneWay,
3368            TrafficSignType::PedestrianCrossing,
3369            TrafficSignType::NoLeftTurn,
3370            TrafficSignType::NoRightTurn,
3371            TrafficSignType::NoUTurn,
3372            TrafficSignType::SchoolZone,
3373            TrafficSignType::Construction,
3374            TrafficSignType::RailroadCrossing,
3375            TrafficSignType::NoOvertaking,
3376            TrafficSignType::AllWay,
3377            TrafficSignType::NoUTurnLeft,
3378            TrafficSignType::NoUTurnRight,
3379            TrafficSignType::StopLine,
3380            TrafficSignType::Crosswalk,
3381            TrafficSignType::DangerSpot,
3382            TrafficSignType::ZebraCrossing,
3383            TrafficSignType::Flight,
3384            TrafficSignType::Cattle,
3385            TrafficSignType::HorseRiders,
3386            TrafficSignType::Amphibians,
3387            TrafficSignType::FallingRocks,
3388            TrafficSignType::SnowOrIce,
3389            TrafficSignType::LooseGravel,
3390            TrafficSignType::Waterside,
3391            TrafficSignType::Clearance,
3392            TrafficSignType::MovableBridge,
3393            TrafficSignType::RightBeforeLeftNextIntersection,
3394            TrafficSignType::TurnLeft,
3395            TrafficSignType::TurnRight,
3396            TrafficSignType::DoubleTurnLeft,
3397            TrafficSignType::DoubleTurnRight,
3398            TrafficSignType::HillDownwards,
3399            TrafficSignType::HillUpwards,
3400            TrafficSignType::UnevenRoad,
3401            TrafficSignType::RoadSlipperyWetOrDirty,
3402            TrafficSignType::SideWinds,
3403            TrafficSignType::RoadNarrowing,
3404            TrafficSignType::RoadNarrowingRight,
3405            TrafficSignType::RoadNarrowingLeft,
3406            TrafficSignType::RoadWorks,
3407            TrafficSignType::TrafficQueues,
3408            TrafficSignType::TwoWayTraffic,
3409            TrafficSignType::AttentionTrafficLight,
3410            TrafficSignType::Pedestrians,
3411            TrafficSignType::ChildrenCrossing,
3412            TrafficSignType::CycleRoute,
3413            TrafficSignType::DeerCrossing,
3414            TrafficSignType::UngatedLevelCrossing,
3415            TrafficSignType::LevelCrossingMarker,
3416            TrafficSignType::RailwayTrafficPriority,
3417            TrafficSignType::GiveWay,
3418            TrafficSignType::PriorityToOppositeDirection,
3419            TrafficSignType::PriorityToOppositeDirectionUpsideDown,
3420            TrafficSignType::PrescribedLeftTurn,
3421            TrafficSignType::PrescribedRightTurn,
3422            TrafficSignType::PrescribedStraight,
3423            TrafficSignType::PrescribedRightWay,
3424            TrafficSignType::PrescribedLeftWay,
3425            TrafficSignType::PrescribedRightTurnAndStraight,
3426            TrafficSignType::PrescribedLeftTurnAndStraight,
3427            TrafficSignType::PrescribedLeftTurnAndRightTurn,
3428            TrafficSignType::PrescribedLeftTurnRightTurnAndStraight,
3429            TrafficSignType::Roundabout,
3430            TrafficSignType::OnewayLeft,
3431            TrafficSignType::OnewayRight,
3432            TrafficSignType::PassLeft,
3433            TrafficSignType::PassRight,
3434            TrafficSignType::SideLaneOpenForTraffic,
3435            TrafficSignType::SideLaneClosedForTraffic,
3436            TrafficSignType::SideLaneClosingForTraffic,
3437            TrafficSignType::BusStop,
3438            TrafficSignType::TaxiStand,
3439            TrafficSignType::BicyclesOnly,
3440            TrafficSignType::HorseRidersOnly,
3441            TrafficSignType::PedestriansOnly,
3442            TrafficSignType::BicyclesPedestriansSharedOnly,
3443            TrafficSignType::BicyclesPedestriansSeparatedLeftOnly,
3444            TrafficSignType::BicyclesPedestriansSeparatedRightOnly,
3445            TrafficSignType::PedestrianZoneBegin,
3446            TrafficSignType::PedestrianZoneEnd,
3447            TrafficSignType::BicycleRoadBegin,
3448            TrafficSignType::BicycleRoadEnd,
3449            TrafficSignType::BusLane,
3450            TrafficSignType::BusLaneBegin,
3451            TrafficSignType::BusLaneEnd,
3452            TrafficSignType::AllProhibited,
3453            TrafficSignType::MotorizedMultitrackProhibited,
3454            TrafficSignType::TrucksProhibited,
3455            TrafficSignType::BicyclesProhibited,
3456            TrafficSignType::MotorcyclesProhibited,
3457            TrafficSignType::MopedsProhibited,
3458            TrafficSignType::HorseRidersProhibited,
3459            TrafficSignType::HorseCarriagesProhibited,
3460            TrafficSignType::CattleProhibited,
3461            TrafficSignType::BusesProhibited,
3462            TrafficSignType::CarsProhibited,
3463            TrafficSignType::CarsTrailersProhibited,
3464            TrafficSignType::TrucksTrailersProhibited,
3465            TrafficSignType::TractorsProhibited,
3466            TrafficSignType::PedestriansProhibited,
3467            TrafficSignType::MotorVehiclesProhibited,
3468            TrafficSignType::HazardousGoodsVehiclesProhibited,
3469            TrafficSignType::OverWeightVehiclesProhibited,
3470            TrafficSignType::VehiclesAxleOverWeightProhibited,
3471            TrafficSignType::VehiclesExcessWidthProhibited,
3472            TrafficSignType::VehiclesExcessHeightProhibited,
3473            TrafficSignType::VehiclesExcessLengthProhibited,
3474            TrafficSignType::DoNotEnter,
3475            TrafficSignType::SnowChainsRequired,
3476            TrafficSignType::WaterPollutantVehiclesProhibited,
3477            TrafficSignType::EnvironmentalZoneBegin,
3478            TrafficSignType::EnvironmentalZoneEnd,
3479            TrafficSignType::PrescribedUTurnLeft,
3480            TrafficSignType::PrescribedUTurnRight,
3481            TrafficSignType::MinimumDistanceForTrucks,
3482            TrafficSignType::SpeedLimitBegin,
3483            TrafficSignType::SpeedLimitZoneBegin,
3484            TrafficSignType::SpeedLimitZoneEnd,
3485            TrafficSignType::MinimumSpeedBegin,
3486            TrafficSignType::OvertakingBanBegin,
3487            TrafficSignType::OvertakingBanForTrucksBegin,
3488            TrafficSignType::SpeedLimitEnd,
3489            TrafficSignType::MinimumSpeedEnd,
3490            TrafficSignType::OvertakingBanEnd,
3491            TrafficSignType::OvertakingBanForTrucksEnd,
3492            TrafficSignType::AllRestrictionsEnd,
3493            TrafficSignType::NoStopping,
3494            TrafficSignType::NoParking,
3495            TrafficSignType::NoParkingZoneBegin,
3496            TrafficSignType::NoParkingZoneEnd,
3497            TrafficSignType::RightOfWayNextIntersection,
3498            TrafficSignType::RightOfWayBegin,
3499            TrafficSignType::RightOfWayEnd,
3500            TrafficSignType::PriorityOverOppositeDirection,
3501            TrafficSignType::PriorityOverOppositeDirectionUpsideDown,
3502            TrafficSignType::TownBegin,
3503            TrafficSignType::TownEnd,
3504            TrafficSignType::CarParking,
3505            TrafficSignType::CarParkingZoneBegin,
3506            TrafficSignType::CarParkingZoneEnd,
3507            TrafficSignType::SidewalkHalfParkingLeft,
3508            TrafficSignType::SidewalkHalfParkingRight,
3509            TrafficSignType::SidewalkParkingLeft,
3510            TrafficSignType::SidewalkParkingRight,
3511            TrafficSignType::SidewalkPerpendicularHalfParkingLeft,
3512            TrafficSignType::SidewalkPerpendicularHalfParkingRight,
3513            TrafficSignType::SidewalkPerpendicularParkingLeft,
3514            TrafficSignType::SidewalkPerpendicularParkingRight,
3515            TrafficSignType::LivingStreetBegin,
3516            TrafficSignType::LivingStreetEnd,
3517            TrafficSignType::Tunnel,
3518            TrafficSignType::EmergencyStoppingLeft,
3519            TrafficSignType::EmergencyStoppingRight,
3520            TrafficSignType::HighwayBegin,
3521            TrafficSignType::HighwayEnd,
3522            TrafficSignType::ExpresswayBegin,
3523            TrafficSignType::ExpresswayEnd,
3524            TrafficSignType::NamedHighwayExit,
3525            TrafficSignType::NamedExpresswayExit,
3526            TrafficSignType::NamedRoadExit,
3527            TrafficSignType::HighwayExit,
3528            TrafficSignType::ExpresswayExit,
3529            TrafficSignType::OnewayStreet,
3530            TrafficSignType::CrossingGuards,
3531            TrafficSignType::Deadend,
3532            TrafficSignType::DeadendExcludingDesignatedActors,
3533            TrafficSignType::FirstAidStation,
3534            TrafficSignType::PoliceStation,
3535            TrafficSignType::Telephone,
3536            TrafficSignType::FillingStation,
3537            TrafficSignType::Hotel,
3538            TrafficSignType::Inn,
3539            TrafficSignType::Kiosk,
3540            TrafficSignType::Toilet,
3541            TrafficSignType::Chapel,
3542            TrafficSignType::TouristInfo,
3543            TrafficSignType::RepairService,
3544            TrafficSignType::PedestrianUnderpass,
3545            TrafficSignType::PedestrianBridge,
3546            TrafficSignType::CamperPlace,
3547            TrafficSignType::AdvisorySpeedLimitBegin,
3548            TrafficSignType::AdvisorySpeedLimitEnd,
3549            TrafficSignType::PlaceName,
3550            TrafficSignType::TouristAttraction,
3551            TrafficSignType::TouristRoute,
3552            TrafficSignType::TouristArea,
3553            TrafficSignType::ShoulderNotPassableMotorVehicles,
3554            TrafficSignType::ShoulderUnsafeTrucksTractors,
3555            TrafficSignType::TollBegin,
3556            TrafficSignType::TollEnd,
3557            TrafficSignType::TollRoad,
3558            TrafficSignType::Customs,
3559            TrafficSignType::InternationalBorderInfo,
3560            TrafficSignType::StreetlightRedBand,
3561            TrafficSignType::FederalHighwayRouteNumber,
3562            TrafficSignType::HighwayRouteNumber,
3563            TrafficSignType::HighwayInterchangeNumber,
3564            TrafficSignType::EuropeanRouteNumber,
3565            TrafficSignType::FederalHighwayDirectionLeft,
3566            TrafficSignType::FederalHighwayDirectionRight,
3567            TrafficSignType::PrimaryRoadDirectionLeft,
3568            TrafficSignType::PrimaryRoadDirectionRight,
3569            TrafficSignType::SecondaryRoadDirectionLeft,
3570            TrafficSignType::SecondaryRoadDirectionRight,
3571            TrafficSignType::DirectionDesignatedActorsLeft,
3572            TrafficSignType::DirectionDesignatedActorsRight,
3573            TrafficSignType::RoutingDesignatedActors,
3574            TrafficSignType::DirectionToHighwayLeft,
3575            TrafficSignType::DirectionToHighwayRight,
3576            TrafficSignType::DirectionToLocalDestinationLeft,
3577            TrafficSignType::DirectionToLocalDestinationRight,
3578            TrafficSignType::ConsolidatedDirections,
3579            TrafficSignType::StreetName,
3580            TrafficSignType::DirectionPreannouncement,
3581            TrafficSignType::DirectionPreannouncementLaneConfig,
3582            TrafficSignType::DirectionPreannouncementHighwayEntries,
3583            TrafficSignType::HighwayAnnouncement,
3584            TrafficSignType::OtherRoadAnnouncement,
3585            TrafficSignType::HighwayAnnouncementTruckStop,
3586            TrafficSignType::HighwayPreannouncementDirections,
3587            TrafficSignType::PoleExit,
3588            TrafficSignType::HighwayDistanceBoard,
3589            TrafficSignType::DetourLeft,
3590            TrafficSignType::DetourRight,
3591            TrafficSignType::NumberedDetour,
3592            TrafficSignType::DetourBegin,
3593            TrafficSignType::DetourEnd,
3594            TrafficSignType::DetourRoutingBoard,
3595            TrafficSignType::OptionalDetour,
3596            TrafficSignType::OptionalDetourRouting,
3597            TrafficSignType::RouteRecommendation,
3598            TrafficSignType::RouteRecommendationEnd,
3599            TrafficSignType::AnnounceLaneTransitionLeft,
3600            TrafficSignType::AnnounceLaneTransitionRight,
3601            TrafficSignType::AnnounceRightLaneEnd,
3602            TrafficSignType::AnnounceLeftLaneEnd,
3603            TrafficSignType::AnnounceRightLaneBegin,
3604            TrafficSignType::AnnounceLeftLaneBegin,
3605            TrafficSignType::AnnounceLaneConsolidation,
3606            TrafficSignType::DetourCityBlock,
3607            TrafficSignType::Gate,
3608            TrafficSignType::PoleWarning,
3609            TrafficSignType::TrafficCone,
3610            TrafficSignType::MobileLaneClosure,
3611            TrafficSignType::ReflectorPost,
3612            TrafficSignType::DirectionalBoardWarning,
3613            TrafficSignType::GuidingPlate,
3614            TrafficSignType::GuidingPlateWedges,
3615            TrafficSignType::ParkingHazard,
3616            TrafficSignType::TrafficLightGreenArrow,
3617            TrafficSignType::Text,
3618            TrafficSignType::Space,
3619            TrafficSignType::Time,
3620            TrafficSignType::Arrow,
3621            TrafficSignType::ConstrainedTo,
3622            TrafficSignType::Except,
3623            TrafficSignType::ValidForDistance,
3624            TrafficSignType::PriorityRoadBottomLeftFourWay,
3625            TrafficSignType::PriorityRoadTopLeftFourWay,
3626            TrafficSignType::PriorityRoadBottomLeftThreeWayStraight,
3627            TrafficSignType::PriorityRoadBottomLeftThreeWaySideways,
3628            TrafficSignType::PriorityRoadTopLeftThreeWayStraight,
3629            TrafficSignType::PriorityRoadBottomRightFourWay,
3630            TrafficSignType::PriorityRoadTopRightFourWay,
3631            TrafficSignType::PriorityRoadBottomRightThreeWayStraight,
3632            TrafficSignType::PriorityRoadBottomRightThreeWaySideway,
3633            TrafficSignType::PriorityRoadTopRightThreeWayStraight,
3634            TrafficSignType::ValidInDistance,
3635            TrafficSignType::StopIn,
3636            TrafficSignType::LeftArrow,
3637            TrafficSignType::LeftBendArrow,
3638            TrafficSignType::RightArrow,
3639            TrafficSignType::RightBendArrow,
3640            TrafficSignType::Accident,
3641            TrafficSignType::Snow,
3642            TrafficSignType::Fog,
3643            TrafficSignType::RollingHighwayInformation,
3644            TrafficSignType::Services,
3645            TrafficSignType::TimeRange,
3646            TrafficSignType::ParkingDiscTimeRestriction,
3647            TrafficSignType::Weight,
3648            TrafficSignType::Wet,
3649            TrafficSignType::ParkingConstraint,
3650            TrafficSignType::NoWaitingSideStripes,
3651            TrafficSignType::Rain,
3652            TrafficSignType::SnowRain,
3653            TrafficSignType::Night,
3654            TrafficSignType::Stop4Way,
3655            TrafficSignType::Truck,
3656            TrafficSignType::TractorsMayBePassed,
3657            TrafficSignType::Hazardous,
3658            TrafficSignType::Trailer,
3659            TrafficSignType::Zone,
3660            TrafficSignType::Motorcycle,
3661            TrafficSignType::MotorcycleAllowed,
3662            TrafficSignType::Car,
3663            TrafficSignType::EmergencyLane,
3664            TrafficSignType::Unknown,
3665        ];
3666
3667        for variant in variants {
3668            let cpp = traffic_control_device_type_to_cpp(&variant);
3669            let roundtrip = traffic_control_device_type_from_cpp(&cpp);
3670            assert_eq!(roundtrip, variant);
3671        }
3672    }
3673}