fn generate_constraints(&self, bc: &BoxConstraints) -> BoxConstraints {
        let (mut new_width, mut new_height) = (bc.max().width, bc.max().height);

        if new_width == f64::INFINITY {
            new_width = new_height * self.ratio;
        } else {
            new_height = new_width / self.ratio;
        }

        if new_width > bc.max().width {
            new_width = bc.max().width;
            new_height = new_width / self.ratio;
        }

        if new_height > bc.max().height {
            new_height = bc.max().height;
            new_width = new_height * self.ratio;
        }

        if new_width < bc.min().width {
            new_width = bc.min().width;
            new_height = new_width / self.ratio;
        }

        if new_height < bc.min().height {
            new_height = bc.min().height;
            new_width = new_height * self.ratio;
        }

        BoxConstraints::tight(bc.constrain(Size::new(new_width, new_height)))
    }
/// Generate `BoxConstraints` that fit within the provided `BoxConstraints`.
///
/// If the generated constraints do not fit then they are constrained to the
/// provided `BoxConstraints`.
Generate `BoxConstraints` that fit within the provided `BoxConstraints`.
If the generated constraints do not fit then they are constrained to the
provided `BoxConstraints`.
Generate ` BoxConstraints ` that fit within the provided ` BoxConstraints ` . If the generated constraints do not fit then they are constrained to the provided ` BoxConstraints ` .
fn generate_constraints(&self, bc: &BoxConstraints) -> BoxConstraints {
        let (mut new_width, mut new_height) = (bc.max().width, bc.max().height);
        if new_width == f64::INFINITY {
            new_width = new_height * self.ratio;
        } else {
            new_height = new_width / self.ratio;
        }
        if new_width > bc.max().width {
            new_width = bc.max().width;
            new_height = new_width / self.ratio;
        }
        if new_height > bc.max().height {
            new_height = bc.max().height;
            new_width = new_height * self.ratio;
        }
        if new_width < bc.min().width {
            new_width = bc.min().width;
            new_height = new_width / self.ratio;
        }
        if new_height < bc.min().height {
            new_height = bc.min().height;
            new_width = new_height * self.ratio;
        }
        BoxConstraints::tight(bc.constrain(Size::new(new_width, new_height)))
    }
fn generate_constraints ( & self , bc : & BoxConstraints ) -> BoxConstraints { let ( mut new_width , mut new_height ) = ( bc . max ( ) . width , bc . max ( ) . height ) ; if new_width == f64 :: INFINITY { new_width = new_height * self . ratio ; } else { new_height = new_width / self . ratio ; } if new_width > bc . max ( ) . width { new_width = bc . max ( ) . width ; new_height = new_width / self . ratio ; } if new_height > bc . max ( ) . height { new_height = bc . max ( ) . height ; new_width = new_height * self . ratio ; } if new_width < bc . min ( ) . width { new_width = bc . min ( ) . width ; new_height = new_width / self . ratio ; } if new_height < bc . min ( ) . height { new_height = bc . min ( ) . height ; new_width = new_height * self . ratio ; } BoxConstraints :: tight ( bc . constrain ( Size :: new ( new_width , new_height ) ) ) }
Generate `BoxConstraints` that fit within the provided `BoxConstraints`.
Generate ` BoxConstraints ` that fit within the provided ` BoxConstraints ` .
&self
bc
&BoxConstraints
&self
bc
&BoxConstraints