Skip to content

Commit d4b7e6b

Browse files
committed
editoast: move ApplicableDirections to editoast_schemas
1 parent ce4d93c commit d4b7e6b

File tree

10 files changed

+23
-15
lines changed

10 files changed

+23
-15
lines changed

editoast/editoast_schemas/src/infra.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
mod applicable_directions;
12
mod direction;
23
mod directional_track_range;
34
mod side;
@@ -6,6 +7,7 @@ mod track_offset;
67
mod track_range;
78
mod waypoint;
89

10+
pub use applicable_directions::ApplicableDirections;
911
pub use direction::Direction;
1012
pub use directional_track_range::DirectionalTrackRange;
1113
pub use side::Side;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use derivative::Derivative;
2+
use serde::Deserialize;
3+
use serde::Serialize;
4+
5+
#[derive(Debug, Derivative, Copy, Clone, Deserialize, Serialize, PartialEq, Eq)]
6+
#[derivative(Default)]
7+
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
8+
pub enum ApplicableDirections {
9+
StartToStop,
10+
StopToStart,
11+
#[derivative(Default)]
12+
Both,
13+
}

editoast/src/converters/osm_to_railjson.rs

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ pub fn parse_osm(osm_pbf_in: PathBuf) -> Result<RailJson, Box<dyn Error + Send +
127127

128128
#[cfg(test)]
129129
mod tests {
130+
use editoast_schemas::infra::ApplicableDirections;
130131
use std::collections::HashMap;
131132

132133
use super::parse_osm;

editoast/src/converters/utils.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use editoast_schemas::infra::ApplicableDirections;
12
use editoast_schemas::infra::Direction;
23
use std::collections::HashMap;
34
use std::str::FromStr;

editoast/src/generated_data/error/speed_sections.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use crate::generated_data::error::ObjectErrorGenerator;
99
use crate::infra_cache::Graph;
1010
use crate::infra_cache::InfraCache;
1111
use crate::infra_cache::ObjectCache;
12-
use crate::schema::ApplicableDirections;
1312
use crate::schema::InfraError;
13+
use editoast_schemas::infra::ApplicableDirections;
1414
use editoast_schemas::infra::Direction;
1515
use editoast_schemas::primitives::OSRDIdentified;
1616
use editoast_schemas::primitives::ObjectRef;

editoast/src/infra_cache/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,6 @@ pub mod tests {
749749
use crate::infra_cache::SwitchCache;
750750
use crate::map::BoundingBox;
751751
use crate::modelsv2::infra::tests::test_infra_transaction;
752-
use crate::schema::ApplicableDirections;
753752
use crate::schema::ApplicableDirectionsTrackRange;
754753
use crate::schema::Electrification;
755754
use crate::schema::Endpoint;
@@ -763,6 +762,7 @@ pub mod tests {
763762
use crate::schema::TrackEndpoint;
764763
use editoast_common::Identifier;
765764
use editoast_common::NonBlankString;
765+
use editoast_schemas::infra::ApplicableDirections;
766766
use editoast_schemas::infra::Direction;
767767
use editoast_schemas::primitives::OSRDIdentified;
768768

editoast/src/schema/mod.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub use buffer_stop::BufferStop;
1919
pub use buffer_stop::BufferStopCache;
2020
pub use detector::Detector;
2121
pub use detector::DetectorCache;
22+
use editoast_schemas::infra::ApplicableDirections;
2223
use editoast_schemas::infra::Direction;
2324
use editoast_schemas::infra::Side;
2425
use editoast_schemas::primitives::OSRDIdentified;
@@ -105,16 +106,6 @@ impl ApplicableDirectionsTrackRange {
105106
}
106107
}
107108

108-
#[derive(Debug, Derivative, Copy, Clone, Deserialize, Serialize, PartialEq, Eq)]
109-
#[derivative(Default)]
110-
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
111-
pub enum ApplicableDirections {
112-
StartToStop,
113-
StopToStart,
114-
#[derivative(Default)]
115-
Both,
116-
}
117-
118109
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, Hash)]
119110
#[serde(rename_all = "UPPERCASE")]
120111
pub enum Endpoint {

editoast/src/views/infra/auto_fixes/electrifications.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ mod tests {
9494
use crate::infra_cache::operation::CacheOperation;
9595
use crate::infra_cache::operation::Operation;
9696
use crate::infra_cache::ObjectCache;
97-
use crate::schema::ApplicableDirections;
9897
use crate::schema::ApplicableDirectionsTrackRange;
9998
use crate::schema::Electrification;
10099
use crate::schema::InfraError;
101100
use editoast_common::Identifier;
101+
use editoast_schemas::infra::ApplicableDirections;
102102
use editoast_schemas::primitives::OSRDObject as _;
103103
use editoast_schemas::primitives::ObjectRef;
104104
use editoast_schemas::primitives::ObjectType;

editoast/src/views/infra/auto_fixes/speed_section.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ mod tests {
9494
use crate::infra_cache::operation::CacheOperation;
9595
use crate::infra_cache::operation::Operation;
9696
use crate::infra_cache::ObjectCache;
97-
use crate::schema::ApplicableDirections;
9897
use crate::schema::ApplicableDirectionsTrackRange;
9998
use crate::schema::InfraError;
10099
use crate::schema::SpeedSection;
101100
use editoast_common::Identifier;
101+
use editoast_schemas::infra::ApplicableDirections;
102102
use editoast_schemas::primitives::OSRDObject as _;
103103
use editoast_schemas::primitives::ObjectRef;
104104
use editoast_schemas::primitives::ObjectType;

editoast/src/views/pathfinding/electrifications.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ pub mod tests {
150150
use crate::models::pathfinding::tests::simple_pathfinding_fixture;
151151
use crate::modelsv2::prelude::*;
152152
use crate::modelsv2::ElectrificationModel;
153-
use crate::schema::ApplicableDirections;
154153
use crate::schema::ApplicableDirectionsTrackRange;
155154
use crate::schema::Electrification as ElectrificationSchema;
156155
use crate::views::tests::create_test_service;
156+
use editoast_schemas::infra::ApplicableDirections;
157157

158158
#[fixture]
159159
fn simple_mode_map() -> TrackMap<String> {

0 commit comments

Comments
 (0)