/// Checks whether the requested amount of cycles can be withdrawn from the
/// canister's balance while respecting the freezing threshold.
///
/// Returns a `CanisterOutOfCyclesError` if the requested amount cannot be
/// withdrawn.
Checks whether the requested amount of cycles can be withdrawn from the
canister's balance while respecting the freezing threshold.

Returns a `CanisterOutOfCyclesError` if the requested amount cannot be
withdrawn.
Checks whether the requested amount of cycles can be withdrawn from the canister ' s balance while respecting the freezing threshold . Returns a ` CanisterOutOfCyclesError ` if the requested amount cannot be withdrawn .
pub fn can_withdraw_cycles(
        &self,
        system_state: &SystemState,
        requested: Cycles,
        canister_current_memory_usage: NumBytes,
        canister_compute_allocation: ComputeAllocation,
    ) -> Result<(), CanisterOutOfCyclesError> {
        let threshold = self.freeze_threshold_cycles(
            system_state,
            canister_current_memory_usage,
            canister_compute_allocation,
        );
        if threshold + requested > system_state.cycles_balance {
            Err(CanisterOutOfCyclesError {
                canister_id: system_state.canister_id(),
                available: system_state.cycles_balance,
                requested,
                threshold,
            })
        } else {
            Ok(())
        }
    }
pub fn can_withdraw_cycles ( & self , system_state : & SystemState , requested : Cycles , canister_current_memory_usage : NumBytes , canister_compute_allocation : ComputeAllocation , ) -> Result < ( ) , CanisterOutOfCyclesError > { let threshold = self . freeze_threshold_cycles ( system_state , canister_current_memory_usage , canister_compute_allocation , ) ; if threshold + requested > system_state . cycles_balance { Err ( CanisterOutOfCyclesError { canister_id : system_state . canister_id ( ) , available : system_state . cycles_balance , requested , threshold , } ) } else { Ok ( ( ) ) } }
Checks whether the requested amount of cycles can be withdrawn from the
canister's balance while respecting the freezing threshold.
Checks whether the requested amount of cycles can be withdrawn from the canister ' s balance while respecting the freezing threshold .
&self
system_state
&SystemState
requested
Cycles
canister_current_memory_usage
NumBytes
canister_compute_allocation
ComputeAllocation