From 3b2be1c4897a32f186bff13a5d762e5072011b6c Mon Sep 17 00:00:00 2001 From: hamz2a Date: Fri, 12 Apr 2024 15:36:17 +0200 Subject: [PATCH] editoast: move ApplicableDirections to editoast_schemas --- editoast/editoast_schemas/src/infra.rs | 2 ++ .../src/infra/applicable_directions.rs | 13 +++++++++++++ editoast/src/converters/osm_to_railjson.rs | 1 + editoast/src/converters/utils.rs | 1 + editoast/src/generated_data/error/speed_sections.rs | 2 +- editoast/src/infra_cache/mod.rs | 2 +- editoast/src/schema/mod.rs | 11 +---------- .../src/views/infra/auto_fixes/electrifications.rs | 2 +- .../src/views/infra/auto_fixes/speed_section.rs | 2 +- editoast/src/views/pathfinding/electrifications.rs | 2 +- 10 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 editoast/editoast_schemas/src/infra/applicable_directions.rs diff --git a/editoast/editoast_schemas/src/infra.rs b/editoast/editoast_schemas/src/infra.rs index 681c2501cae..dce8ad4be8b 100644 --- a/editoast/editoast_schemas/src/infra.rs +++ b/editoast/editoast_schemas/src/infra.rs @@ -1,3 +1,4 @@ +mod applicable_directions; mod direction; mod directional_track_range; mod side; @@ -6,6 +7,7 @@ mod track_offset; mod track_range; mod waypoint; +pub use applicable_directions::ApplicableDirections; pub use direction::Direction; pub use directional_track_range::DirectionalTrackRange; pub use side::Side; diff --git a/editoast/editoast_schemas/src/infra/applicable_directions.rs b/editoast/editoast_schemas/src/infra/applicable_directions.rs new file mode 100644 index 00000000000..c0d50107835 --- /dev/null +++ b/editoast/editoast_schemas/src/infra/applicable_directions.rs @@ -0,0 +1,13 @@ +use derivative::Derivative; +use serde::Deserialize; +use serde::Serialize; + +#[derive(Debug, Derivative, Copy, Clone, Deserialize, Serialize, PartialEq, Eq)] +#[derivative(Default)] +#[serde(rename_all = "SCREAMING_SNAKE_CASE")] +pub enum ApplicableDirections { + StartToStop, + StopToStart, + #[derivative(Default)] + Both, +} diff --git a/editoast/src/converters/osm_to_railjson.rs b/editoast/src/converters/osm_to_railjson.rs index f2695a1087b..dd8be13b895 100644 --- a/editoast/src/converters/osm_to_railjson.rs +++ b/editoast/src/converters/osm_to_railjson.rs @@ -127,6 +127,7 @@ pub fn parse_osm(osm_pbf_in: PathBuf) -> Result TrackMap {