[−][src]Struct orbtk_utils::Rectangle
A Rectangle
is normally expressed as a top-left corner and a size
Examples
let rectangle = Rectangle::new((0., 5.),(10., 7.)); assert_eq!(rectangle.x(), 0.); assert_eq!(rectangle.y(), 5.); assert_eq!(rectangle.width(), 10.); assert_eq!(rectangle.height(), 7.);
Implementations
impl Rectangle
[src]
pub fn new(position: impl Into<Point>, size: impl Into<Size>) -> Self
[src]
Create a new rectangle with the given parameters.
pub fn x(&self) -> f64
[src]
Gets x.
pub fn set_x(&mut self, x: impl Into<f64>)
[src]
Sets x.
pub fn y(&self) -> f64
[src]
Gets y.
pub fn set_y(&mut self, y: impl Into<f64>)
[src]
Sets y.
pub fn position(&self) -> Point
[src]
Gets position as Point
.
pub fn set_position(&mut self, position: impl Into<Point>)
[src]
Sets position.
pub fn width(&self) -> f64
[src]
Gets the width.
pub fn set_width(&mut self, width: impl Into<f64>)
[src]
Sets the width.
pub fn height(&self) -> f64
[src]
Gets the height.
pub fn set_height(&mut self, height: impl Into<f64>)
[src]
Sets the height.
pub fn size(&self) -> Size
[src]
Gets the size with width and height.
pub fn set_size(&mut self, width: impl Into<f64>, height: impl Into<f64>)
[src]
Sets the size with width and height.
pub fn contains(&self, point: impl Into<Point>) -> bool
[src]
Checks if this rect contains the given point
.
pub fn contains_rect(&self, rect: &Rectangle) -> bool
[src]
Checks if this rect contains the given rect
.
pub fn intersects(&self, rect: &Rectangle) -> bool
[src]
Checks if this rect intersects with the given rect
.
Trait Implementations
impl Clone for Rectangle
[src]
impl Copy for Rectangle
[src]
impl Debug for Rectangle
[src]
impl Default for Rectangle
[src]
impl From<(Point, Size)> for Rectangle
[src]
impl From<(f64, f64, f64, f64)> for Rectangle
[src]
impl From<(i32, i32, i32, i32)> for Rectangle
[src]
impl PartialEq<Rectangle> for Rectangle
[src]
impl StructuralPartialEq for Rectangle
[src]
Auto Trait Implementations
impl RefUnwindSafe for Rectangle
impl Send for Rectangle
impl Sync for Rectangle
impl Unpin for Rectangle
impl UnwindSafe for Rectangle
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,