/// Create a new triangle given its sides.
///
/// Returns `None` when the sides combination is invalid according to the puzzle
/// definition:
/// > In a valid triangle, the sum of any two sides must be larger than
/// > the remaining side.
Create a new triangle given its sides.
Returns `None` when the sides combination is invalid according to the puzzle
definition:
> In a valid triangle, the sum of any two sides must be larger than
> the remaining side.
Create a new triangle given its sides . Returns ` None ` when the sides combination is invalid according to the puzzle definition : > In a valid triangle the sum of any two sides must be larger than > the remaining side .
pub fn new(sides: (u32, u32, u32)) -> Option<Triangle> {
            let xs = [sides.0, sides.1, sides.2];
            let max = *xs.iter().max().unwrap();
            let sum: u32 = xs.iter().sum();
            if (sum - max) > max {
                Some(Triangle(sides.0, sides.1, sides.2))
            } else {
                None
            }
        }
pub fn new ( sides : ( u32 , u32 , u32 ) ) -> Option < Triangle > { let xs = [ sides . 0 , sides . 1 , sides . 2 ] ; let max = * xs . iter ( ) . max ( ) . unwrap ( ) ; let sum : u32 = xs . iter ( ) . sum ( ) ; if ( sum - max ) > max { Some ( Triangle ( sides . 0 , sides . 1 , sides . 2 ) ) } else { None } }
Create a new triangle given its sides.
Create a new triangle given its sides .
sides
(u32, u32, u32)