pub fn from_floats(left: f32, right: f32) -> Self {
            if !left.is_finite() || !right.is_finite() || left.abs() > 1.0 || right.abs() > 1.0 {
                // Don't use is_infinite() as it doesn't include NaNs
                panic!("Motor power ratio must be a number between -1 and 1.");
            }

            let left = Self::float_to_int(left);
            let right = Self::float_to_int(right);
            MotorPowerRatio { left, right }
        }
/// Construct the struct from two floats between -1.0 (max backward
/// power) and 1.0 (max forward power). Note that left and right motors
/// are independent.
///
/// # Panics
///
/// This method panic if both numbers aren't between -1.0 and 1.0
/// (inclusive).
Construct the struct from two floats between -1.0 (max backward
power) and 1.0 (max forward power). Note that left and right motors
are independent.
Construct the struct from two floats between - 1 . 0 ( max backward power ) and 1 . 0 ( max forward power ) . Note that left and right motors are independent .
pub fn from_floats(left: f32, right: f32) -> Self {
            if !left.is_finite() || !right.is_finite() || left.abs() > 1.0 || right.abs() > 1.0 {
                // Don't use is_infinite() as it doesn't include NaNs
                panic!("Motor power ratio must be a number between -1 and 1.");
            }
            let left = Self::float_to_int(left);
            let right = Self::float_to_int(right);
            MotorPowerRatio { left, right }
        }
pub fn from_floats ( left : f32 , right : f32 ) -> Self { if ! left . is_finite ( ) || ! right . is_finite ( ) || left . abs ( ) > 1.0 || right . abs ( ) > 1.0 { // Don't use is_infinite() as it doesn't include NaNs panic ! ( " " ) ; } let left = Self :: float_to_int ( left ) ; let right = Self :: float_to_int ( right ) ; MotorPowerRatio { left , right } }
Construct the struct from two floats between -1.0 (max backward
power) and 1.0 (max forward power).
Construct the struct from two floats between - 1 . 0 ( max backward power ) and 1 . 0 ( max forward power ) .
left
f32
right
f32
left
f32
right
f32
panics
This method panic if both numbers aren't between -1.0 and 1.0
(inclusive).
This method panic if both numbers aren ' t between - 1 . 0 and 1 . 0 ( inclusive ) .