pub fn new<N>(depot: N, vehicle_capacity: f64, cache: &DistanceCache) -> Self
    where
        N: AsRef<Node>,
    {
        let route = Self::new_(vehicle_capacity, cache);

        unsafe {
            // Create new depot
            let depot_ref = depot.as_ref().inner.unwrap().as_ref();
            let new_depot = Box::new(InnerNode {
                index: depot_ref.index,
                demand: depot_ref.demand,
                kind: depot_ref.kind,
                route: route.inner,
                predecessor: None,
                successor: None,
            });
            let new_depot = NonNull::new(Box::leak(new_depot));
            (*route.inner.unwrap().as_ptr()).has_depot = true;
            Self::push_(&route.inner, &new_depot, false);
        }

        route
    }
// TODO: once API is stable, change name to new.
once API is stable, change name to new.
once API is stable change name to new .
pub fn new<N>(depot: N, vehicle_capacity: f64, cache: &DistanceCache) -> Self
    where
        N: AsRef<Node>,
    {
        let route = Self::new_(vehicle_capacity, cache);
        unsafe {
            // Create new depot
            let depot_ref = depot.as_ref().inner.unwrap().as_ref();
            let new_depot = Box::new(InnerNode {
                index: depot_ref.index,
                demand: depot_ref.demand,
                kind: depot_ref.kind,
                route: route.inner,
                predecessor: None,
                successor: None,
            });
            let new_depot = NonNull::new(Box::leak(new_depot));
            (*route.inner.unwrap().as_ptr()).has_depot = true;
            Self::push_(&route.inner, &new_depot, false);
        }
        route
    }
pub fn new < N > ( depot : N , vehicle_capacity : f64 , cache : & DistanceCache ) -> Self where N : AsRef < Node > , { let route = Self :: new_ ( vehicle_capacity , cache ) ; unsafe { // Create new depot let depot_ref = depot . as_ref ( ) . inner . unwrap ( ) . as_ref ( ) ; let new_depot = Box :: new ( InnerNode { index : depot_ref . index , demand : depot_ref . demand , kind : depot_ref . kind , route : route . inner , predecessor : None , successor : None , } ) ; let new_depot = NonNull :: new ( Box :: leak ( new_depot ) ) ; ( * route . inner . unwrap ( ) . as_ptr ( ) ) . has_depot = true ; Self :: push_ ( & route . inner , & new_depot , false ) ; } route }
TODO: once API is stable, change name to new.
TODO : once API is stable change name to new .
depot
N
vehicle_capacity
f64
cache
&DistanceCache