pub trait PlaceRectMut: TranslateMut {
    // Provided method
    fn place_mut(&mut self, mode: PlaceMode, srect: Rect, pt: Point) { ... }
}
Expand description

A geometric shape that can be placed at a point.

§Examples

let mut rect1 = Rect::from_sides(0, 0, 100, 200);
rect1.place_mut(PlaceMode::Center, rect1, Point::new(25, 25));
assert_eq!(rect1, Rect::from_sides(-25, -75, 75, 125));

// Alternate rectangle to align `rect1` with.
// Conceptually, this represents that `rect1` has
// 5 units of hangover space on all sides that should
// not contribute to placement.
let rect1_alt = rect1.shrink_all(5).unwrap();
rect1.place_mut(PlaceMode::Corner(Corner::UpperRight), rect1_alt, Point::new(25, 25));
assert_eq!(rect1, Rect::from_sides(-70, -170, 30, 30));

Provided Methods§

source

fn place_mut(&mut self, mode: PlaceMode, srect: Rect, pt: Point)

Places an object at the given point.

For center alignments, the center’s non-integer coordinates are rounded down to the nearest integer. This behavior is subject to change and should not be relied upon.

Implementors§

source§

impl<T> PlaceRectMut for T
where T: TranslateMut,