/// Signals a canister to start.
///
/// If the canister is stopped, then the canister is immediately
/// transitioned into the "running" state.
///
/// If the canister is already running, this operation is a no-op.
///
/// If the canister is in the process of being stopped (i.e stopping), then
/// the canister is transitioned back into a running state and the
/// `stop_contexts` that were used for stopping the canister are
/// returned.
Signals a canister to start.
If the canister is stopped, then the canister is immediately
transitioned into the "running" state.

If the canister is already running, this operation is a no-op.

If the canister is in the process of being stopped , then
the canister is transitioned back into a running state and the
`stop_contexts` that were used for stopping the canister are
returned.
Signals a canister to start . If the canister is stopped then the canister is immediately transitioned into the " running " state . If the canister is already running this operation is a no - op . If the canister is in the process of being stopped then the canister is transitioned back into a running state and the ` stop_contexts ` that were used for stopping the canister are returned .
pub(crate) fn start_canister(
        &self,
        sender: PrincipalId,
        canister: &mut CanisterState,
    ) -> Result<Vec<StopCanisterContext>, CanisterManagerError> {
        self.validate_controller(canister, &sender)?;
        let stop_contexts = match &mut canister.system_state.status {
            CanisterStatus::Stopping { stop_contexts, .. } => std::mem::take(stop_contexts),
            CanisterStatus::Running { .. } | CanisterStatus::Stopped => {
                Vec::new() // No stop contexts to return.
            }
        };
        // Transition the canister into "running".
        let status = match &canister.system_state.status {
            CanisterStatus::Running {
                call_context_manager,
            }
            | CanisterStatus::Stopping {
                call_context_manager,
                ..
            } => CanisterStatus::Running {
                call_context_manager: call_context_manager.clone(),
            },
            CanisterStatus::Stopped => CanisterStatus::new_running(),
        };
        canister.system_state.status = status;
        Ok(stop_contexts)
    }
pub ( crate ) fn start_canister ( & self , sender : PrincipalId , canister : & mut CanisterState , ) -> Result < Vec < StopCanisterContext > , CanisterManagerError > { self . validate_controller ( canister , & sender ) ? ; let stop_contexts = match & mut canister . system_state . status { CanisterStatus :: Stopping { stop_contexts , .. } => std :: mem :: take ( stop_contexts ) , CanisterStatus :: Running { .. } | CanisterStatus :: Stopped => { Vec :: new ( ) // No stop contexts to return. } } ; // Transition the canister into "running". let status = match & canister . system_state . status { CanisterStatus :: Running { call_context_manager , } | CanisterStatus :: Stopping { call_context_manager , .. } => CanisterStatus :: Running { call_context_manager : call_context_manager . clone ( ) , } , CanisterStatus :: Stopped => CanisterStatus :: new_running ( ) , } ; canister . system_state . status = status ; Ok ( stop_contexts ) }
Signals a canister to start.
Signals a canister to start .
&self
sender
PrincipalId
canister
&mut CanisterState