routee-compass-core 0.3.0

The core routing algorithms and data structures of the RouteE-Compass energy-aware routing engine
Documentation
use crate::model::{
    frontier::{frontier_model::FrontierModel, frontier_model_error::FrontierModelError},
    property::edge::Edge,
    traversal::state::traversal_state::TraversalState,
};

pub struct RoadClassFrontierModel {
    pub road_class_lookup: Vec<bool>,
}

impl FrontierModel for RoadClassFrontierModel {
    fn valid_frontier(
        &self,
        edge: &Edge,
        _state: &TraversalState,
    ) -> Result<bool, FrontierModelError> {
        self.road_class_lookup
            .get(edge.edge_id.0.clone() as usize)
            .ok_or(FrontierModelError::MissingIndex(format!(
                "{}",
                edge.edge_id
            )))
            .cloned()
    }
}