diff --git a/editoast/src/core/pathfinding.rs b/editoast/src/core/pathfinding.rs index 236494675d1..02f8a6afb58 100644 --- a/editoast/src/core/pathfinding.rs +++ b/editoast/src/core/pathfinding.rs @@ -157,7 +157,7 @@ pub enum PathfindingNotFound { /// An oriented range on a track section. /// `begin` is always less than `end`. -#[derive(Serialize, Deserialize, Clone, Debug, ToSchema, Hash, PartialEq, Eq)] +#[derive(Serialize, Deserialize, Clone, ToSchema, Hash, PartialEq, Eq)] pub struct TrackRange { /// The track section identifier. #[schema(inline)] @@ -182,6 +182,17 @@ impl From for TrackRange { } } +impl std::fmt::Debug for TrackRange { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { + write!(f, "'{}+", self.track_section)?; + if matches!(self.direction, Direction::StartToStop) { + write!(f, "{}-{}'", self.begin, self.end) + } else { + write!(f, "{}-{}'", self.end, self.begin) + } + } +} + #[cfg(test)] impl std::str::FromStr for TrackRange { type Err = String;