many changes
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
This commit is contained in:
parent
4777f46a38
commit
be177af6cd
25 changed files with 2059 additions and 47 deletions
37
libseptastic/src/direction.rs
Normal file
37
libseptastic/src/direction.rs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(sqlx::Type, Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
#[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 route_id: String,
|
||||
pub direction_id: i64,
|
||||
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)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue