pub fn complete_path(&self, path: &[ID]) -> Option<Rc<Route<ID>>> {
        if path.len() < 2{
            return None;
        }
        let mut route = Route::start_rc(path[0].clone());
        // pos is a pointer to the slice, dont copy or clone anything
        for pos in &path[1..path.len()-1] {
            if ! route.contains(pos){
                route = self.shortest_path_r(route, pos.clone())?;
            }
        }
        self.shortest_path_r(route, path[path.len() - 1].clone())
    }
// this method, iterate over all ids, and find the shortest path if not contains pos 0
this method, iterate over all ids, and find the shortest path if not contains pos 0
this method iterate over all ids and find the shortest path if not contains pos 0
pub fn complete_path(&self, path: &[ID]) -> Option<Rc<Route<ID>>> {
        if path.len() < 2{
            return None;
        }
        let mut route = Route::start_rc(path[0].clone());
        // pos is a pointer to the slice, dont copy or clone anything
        for pos in &path[1..path.len()-1] {
            if ! route.contains(pos){
                route = self.shortest_path_r(route, pos.clone())?;
            }
        }
        self.shortest_path_r(route, path[path.len() - 1].clone())
    }
pub fn complete_path ( & self , path : & [ ID ] ) -> Option < Rc < Route < ID > > > { if path . len ( ) < 2 { return None ; } let mut route = Route :: start_rc ( path [ 0 ] . clone ( ) ) ; // pos is a pointer to the slice, dont copy or clone anything for pos in & path [ 1 .. path . len ( ) - 1 ] { if ! route . contains ( pos ) { route = self . shortest_path_r ( route , pos . clone ( ) ) ? ; } } self . shortest_path_r ( route , path [ path . len ( ) - 1 ] . clone ( ) ) }
this method, iterate over all ids, and find the shortest path if not contains pos 0
this method iterate over all ids and find the shortest path if not contains pos 0
&self
path
&[ID]
&self
path
&[ID]