use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct StopIdx(u32);
impl StopIdx {
pub const fn new(n: u32) -> Self {
Self(n)
}
pub const fn get(self) -> u32 {
self.0
}
#[inline]
pub(crate) fn idx(self) -> usize {
self.0 as usize
}
}
impl fmt::Display for StopIdx {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
impl From<u32> for StopIdx {
fn from(n: u32) -> Self {
Self(n)
}
}
impl From<StopIdx> for u32 {
fn from(s: StopIdx) -> Self {
s.0
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct RouteIdx(u32);
impl RouteIdx {
pub const fn new(n: u32) -> Self {
Self(n)
}
pub const fn get(self) -> u32 {
self.0
}
#[inline]
pub(crate) fn idx(self) -> usize {
self.0 as usize
}
}
impl fmt::Display for RouteIdx {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
impl From<u32> for RouteIdx {
fn from(n: u32) -> Self {
Self(n)
}
}
impl From<RouteIdx> for u32 {
fn from(r: RouteIdx) -> Self {
r.0
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct TripIdx(u32);
impl TripIdx {
pub const fn new(n: u32) -> Self {
Self(n)
}
pub const fn get(self) -> u32 {
self.0
}
#[inline]
pub(crate) fn idx(self) -> usize {
self.0 as usize
}
}
impl fmt::Display for TripIdx {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
impl From<u32> for TripIdx {
fn from(n: u32) -> Self {
Self(n)
}
}
impl From<TripIdx> for u32 {
fn from(t: TripIdx) -> Self {
t.0
}
}