Struct design_pattern_examples_rust::handlerchain::handlerchain_messagewindow::WindowRectangle
source · pub struct WindowRectangle {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
Expand description
Represents a rectangular region, with upper left and lower right coordinates.
For this example, the minimum width of a rectangle is 4 x 4.
Fields§
§left: i32
§top: i32
§right: i32
§bottom: i32
Implementations§
source§impl WindowRectangle
impl WindowRectangle
sourcepub fn new(left: i32, top: i32, width: i32, height: i32) -> WindowRectangle
pub fn new(left: i32, top: i32, width: i32, height: i32) -> WindowRectangle
Constructor.
Parameters
-
left
X coordinate of upper left corner.
-
top
Y coordinate of upper left corner.
-
width
Width of rectangle.
-
height
Height of rectangle.
Returns
Returns a new instance of the WindowRectangle struct.
sourcepub fn point_inside(&self, point: &MessagePosition) -> bool
pub fn point_inside(&self, point: &MessagePosition) -> bool
Determine if the given point is in the rectangle.
Parameters
-
point
A MessagePosition struct to determine if it is inside this WindowRectangle.
Returns
Returns true if the point is in this WindowRectangle; otherwise, returns false.