routee-compass-core 0.18.0

The core routing algorithms and data structures of the RouteE-Compass energy-aware routing engine
Documentation
use std::{cmp::Ordering, fmt::Display};

use allocative::Allocative;
use serde::{Deserialize, Serialize};

#[derive(Copy, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Default, Allocative)]
pub struct VertexId(pub usize);

impl PartialOrd for VertexId {
    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
        Some(self.cmp(other))
    }
}

impl Ord for VertexId {
    fn cmp(&self, other: &Self) -> Ordering {
        self.0.cmp(&other.0)
    }
}

impl Display for VertexId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}