fn to_replicas_floor(&self, replicas: u32) -> u32 {
        match self {
            AvailabilityPolicy::Percentage(percstr) => {
                let digits = percstr.chars().take_while(|ch| *ch != '%').collect::<String>();
                let surgeperc: u32 = digits.parse().unwrap(); // safe due to verify ^
                ((f64::from(replicas) * f64::from(surgeperc)) / 100.0).floor() as u32
            }
            AvailabilityPolicy::Unsigned(u) => *u,
        }
    }
/// Figure out how many the availability policy refers to
///
/// This multiplies the policy with num replicas and rounds down (for maxUnavailable)
Figure out how many the availability policy refers to
This multiplies the policy with num replicas and rounds down (for maxUnavailable)
Figure out how many the availability policy refers to This multiplies the policy with num replicas and rounds down ( for maxUnavailable )
fn to_replicas_floor(&self, replicas: u32) -> u32 {
        match self {
            AvailabilityPolicy::Percentage(percstr) => {
                let digits = percstr.chars().take_while(|ch| *ch != '%').collect::<String>();
                let surgeperc: u32 = digits.parse().unwrap(); // safe due to verify ^
                ((f64::from(replicas) * f64::from(surgeperc)) / 100.0).floor() as u32
            }
            AvailabilityPolicy::Unsigned(u) => *u,
        }
    }
fn to_replicas_floor ( & self , replicas : u32 ) -> u32 { match self { AvailabilityPolicy :: Percentage ( percstr ) => { let digits = percstr . chars ( ) . take_while ( | ch | * ch != '%' ) . collect :: < String > ( ) ; let surgeperc : u32 = digits . parse ( ) . unwrap ( ) ; // safe due to verify ^ ( ( f64 :: from ( replicas ) * f64 :: from ( surgeperc ) ) / 100.0 ) . floor ( ) as u32 } AvailabilityPolicy :: Unsigned ( u ) => * u , } }
Figure out how many the availability policy refers to
This multiplies the policy with num replicas and rounds down (for maxUnavailable)
Figure out how many the availability policy refers to This multiplies the policy with num replicas and rounds down ( for maxUnavailable )
&self
replicas
u32
&self
replicas
u32