All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 39s
36 lines
1.1 KiB
Rust
36 lines
1.1 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(
|
|
sqlx::Type, Serialize, Deserialize, PartialEq, Debug, Clone, Copy, Eq, PartialOrd, Ord,
|
|
)]
|
|
#[sqlx(type_name = "septa_direction_type", rename_all = "snake_case")]
|
|
pub enum CardinalDirection {
|
|
Northbound,
|
|
Southbound,
|
|
Eastbound,
|
|
Westbound,
|
|
Inbound,
|
|
Outbound,
|
|
Loop,
|
|
}
|
|
|
|
#[derive(::sqlx::Decode, Serialize, Deserialize, Debug, Clone)]
|
|
pub struct Direction {
|
|
pub direction: CardinalDirection,
|
|
pub direction_destination: String,
|
|
}
|
|
|
|
impl std::fmt::Display for CardinalDirection {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
let output = match self {
|
|
CardinalDirection::Northbound => "Northbound",
|
|
CardinalDirection::Southbound => "Southbound",
|
|
CardinalDirection::Eastbound => "Eastbound",
|
|
CardinalDirection::Westbound => "Westbound",
|
|
CardinalDirection::Inbound => "Inbound",
|
|
CardinalDirection::Outbound => "Outbound",
|
|
CardinalDirection::Loop => "Loop",
|
|
};
|
|
std::write!(f, "{}", output)
|
|
}
|
|
}
|