1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
use std::ops::Add; use num::traits::Zero; use direction::*; use grid_2d::*; use grid::*; use error::*; use metadata::*; use search::*; impl<Cost: Copy + Add<Cost> + PartialOrd<Cost> + Zero> SearchContext<Cost> { pub fn dijkstra<G, V, D>( &mut self, grid: &G, start: Coord, goal: Coord, directions: D, path: &mut Vec<Direction>, ) -> Result<SearchMetadata, Error> where G: CostGrid<Cost = Cost>, V: Into<Direction>, D: Copy + IntoIterator<Item = V>, { self.search_general(grid, start, goal, directions, |_, _| Zero::zero(), path) } }