pub fn eject(node: &mut Node) {
        if let Some(inner) = node.inner {
            unsafe {
                if let Some(route) = inner.as_ref().route {
                    (*route.as_ptr()).n_nodes -= 1;
                    (*route.as_ptr()).load -= inner.as_ref().demand;

                    if let Some(pred) = inner.as_ref().predecessor {
                        (*pred.as_ptr()).successor = inner.as_ref().successor;
                    } else {
                        (*route.as_ptr()).first = inner.as_ref().successor;
                    }

                    if let Some(succ) = inner.as_ref().successor {
                        (*succ.as_ptr()).predecessor = inner.as_ref().predecessor;
                    } else {
                        (*route.as_ptr()).last = inner.as_ref().predecessor;
                    }

                    (*inner.as_ptr()).route = None;
                    (*inner.as_ptr()).predecessor = None;
                    (*inner.as_ptr()).successor = None;
                }
            }
        }
    }
/// Removes a node from its current `Route`. The function will do nothing if it is not assigned
/// to any `Route`.
///
/// # Examples
/// ```
/// # use vehr_core::reg::DistanceCache;
/// # use vehr_core::tour::Node;
/// # use vehr_core::tour::NodeKind;
/// # use vehr_core::tour::Route;
/// let mut route = Route::new(&Node::new(0, NodeKind::Depot, 0.), 10., &DistanceCache::default());
/// let mut nodes: Vec<_> = (1..=4).map(|ii| {
///         let node = Node::new(ii, NodeKind::Request, 10.);
///         route.push_back(&node);
///         node
/// }).collect();
///
/// Route::eject(nodes.get_mut(2).unwrap());
/// assert_eq!(&vec![0, 1, 2 , 4], &route.export().route());
/// ```
Removes a node from its current `Route`. The function will do nothing if it is not assigned
to any `Route`.
Removes a node from its current ` Route ` . The function will do nothing if it is not assigned to any ` Route ` .
pub fn eject(node: &mut Node) {
        if let Some(inner) = node.inner {
            unsafe {
                if let Some(route) = inner.as_ref().route {
                    (*route.as_ptr()).n_nodes -= 1;
                    (*route.as_ptr()).load -= inner.as_ref().demand;
                    if let Some(pred) = inner.as_ref().predecessor {
                        (*pred.as_ptr()).successor = inner.as_ref().successor;
                    } else {
                        (*route.as_ptr()).first = inner.as_ref().successor;
                    }
                    if let Some(succ) = inner.as_ref().successor {
                        (*succ.as_ptr()).predecessor = inner.as_ref().predecessor;
                    } else {
                        (*route.as_ptr()).last = inner.as_ref().predecessor;
                    }
                    (*inner.as_ptr()).route = None;
                    (*inner.as_ptr()).predecessor = None;
                    (*inner.as_ptr()).successor = None;
                }
            }
        }
    }
pub fn eject ( node : & mut Node ) { if let Some ( inner ) = node . inner { unsafe { if let Some ( route ) = inner . as_ref ( ) . route { ( * route . as_ptr ( ) ) . n_nodes -= 1 ; ( * route . as_ptr ( ) ) . load -= inner . as_ref ( ) . demand ; if let Some ( pred ) = inner . as_ref ( ) . predecessor { ( * pred . as_ptr ( ) ) . successor = inner . as_ref ( ) . successor ; } else { ( * route . as_ptr ( ) ) . first = inner . as_ref ( ) . successor ; } if let Some ( succ ) = inner . as_ref ( ) . successor { ( * succ . as_ptr ( ) ) . predecessor = inner . as_ref ( ) . predecessor ; } else { ( * route . as_ptr ( ) ) . last = inner . as_ref ( ) . predecessor ; } ( * inner . as_ptr ( ) ) . route = None ; ( * inner . as_ptr ( ) ) . predecessor = None ; ( * inner . as_ptr ( ) ) . successor = None ; } } } }
Removes a node from its current `Route`.
Removes a node from its current ` Route ` .
node
&mut Node
examples
None
use vehr_core::reg::distancecache;
None
use vehr_core::tour::node;
None
use vehr_core::tour::nodekind;
None
use vehr_core::tour::route;
let mut route = Route::new(&Node::new(0, NodeKind::Depot, 0.), 10., &DistanceCache::default());
let mut nodes: Vec<_> = (1..=4).map(|ii| {
let node = Node::new(ii, NodeKind::Request, 10.);
route.push_back(&node);
node
}).collect().


let mut route = Route :: new ( &Node :: new ( 0 NodeKind :: Depot 0 . ) 10 . &DistanceCache :: default () ) ; let mut nodes : Vec<_ > = ( 1 .. = 4 ) . map ( |ii| { let node = Node :: new ( ii NodeKind :: Request 10 . ) ; route . push_back ( &node ) ; node } ) . collect () .