fn next_events_shutting_down(
    service_handler: &ServiceHandler,
    shutting_down: ShuttingDown,
) -> Vec<Event> {
    let ev_status =
        |status: ServiceStatus| Event::new_status_update(service_handler.name(), status);
    let vev_status = |status: ServiceStatus| vec![ev_status(status)];

    // Handle the new state separately if we're shutting down.
    match &service_handler.status {
        ServiceStatus::Running | ServiceStatus::Started => vec![
            ev_status(ServiceStatus::InKilling),
            Event::Kill(service_handler.name().clone()),
        ],
        ServiceStatus::Success | ServiceStatus::Initial => vev_status(ServiceStatus::Finished),
        ServiceStatus::Failed => vev_status(ServiceStatus::FinishedFailed),
        ServiceStatus::InKilling if should_force_kill(service_handler, shutting_down) => {
            vec![Event::new_force_kill(service_handler.name())]
        }
        _ => vec![],
    }
}
/// This next function assumes that the system is shutting down.
/// It will make progress in the direction of shutting everything down.
This next function assumes that the system is shutting down.
It will make progress in the direction of shutting everything down.
This next function assumes that the system is shutting down . It will make progress in the direction of shutting everything down .
fn next_events_shutting_down(
    service_handler: &ServiceHandler,
    shutting_down: ShuttingDown,
) -> Vec<Event> {
    let ev_status =
        |status: ServiceStatus| Event::new_status_update(service_handler.name(), status);
    let vev_status = |status: ServiceStatus| vec![ev_status(status)];
    // Handle the new state separately if we're shutting down.
    match &service_handler.status {
        ServiceStatus::Running | ServiceStatus::Started => vec![
            ev_status(ServiceStatus::InKilling),
            Event::Kill(service_handler.name().clone()),
        ],
        ServiceStatus::Success | ServiceStatus::Initial => vev_status(ServiceStatus::Finished),
        ServiceStatus::Failed => vev_status(ServiceStatus::FinishedFailed),
        ServiceStatus::InKilling if should_force_kill(service_handler, shutting_down) => {
            vec![Event::new_force_kill(service_handler.name())]
        }
        _ => vec![],
    }
}
fn next_events_shutting_down ( service_handler : & ServiceHandler , shutting_down : ShuttingDown , ) -> Vec < Event > { let ev_status = | status : ServiceStatus | Event :: new_status_update ( service_handler . name ( ) , status ) ; let vev_status = | status : ServiceStatus | vec ! [ ev_status ( status ) ] ; // Handle the new state separately if we're shutting down. match & service_handler . status { ServiceStatus :: Running | ServiceStatus :: Started => vec ! [ ev_status ( ServiceStatus InKilling ) Event Kill ( service_handler name ( ) clone ( ) ) ] , ServiceStatus :: Success | ServiceStatus :: Initial => vev_status ( ServiceStatus :: Finished ) , ServiceStatus :: Failed => vev_status ( ServiceStatus :: FinishedFailed ) , ServiceStatus :: InKilling if should_force_kill ( service_handler , shutting_down ) => { vec ! [ Event new_force_kill ( service_handler name ( ) ) ] } _ => vec ! [ ] , } }
This next function assumes that the system is shutting down.
This next function assumes that the system is shutting down .
service_handler
&ServiceHandler
shutting_down
ShuttingDown
service_handler
&ServiceHandler
shutting_down
ShuttingDown