[−][src]Struct bear_lib_terminal::geometry::Rect
A rectangle, described by its four corners and a size.
Fields
top_left: PointThe top-left corner.
top_right: PointThe top-right corner.
bottom_right: PointThe bottom-right corner.
bottom_left: PointThe bottom-left corner.
size: SizeThe Rectangle's size.
Methods
impl Rect[src]
pub fn from_size(origin: Point, size: Size) -> Rect[src]
Construct a Rect from its top-left corner and its size.
Examples
let rect = Rect::from_size(Point::new(10, 20), Size::new(30, 40)); assert_eq!(rect.top_left, Point::new(10, 20)); assert_eq!(rect.top_right, Point::new(40, 20)); assert_eq!(rect.bottom_left, Point::new(10, 60)); assert_eq!(rect.bottom_right, Point::new(40, 60)); assert_eq!(rect.size, Size::new(30, 40));
pub fn from_points(top_left: Point, bottom_right: Point) -> Rect[src]
Construct a Rect from its top-left and bottom-right corners.
Examples
let rect = Rect::from_points(Point::new(10, 20), Point::new(30, 40)); assert_eq!(rect.top_left, Point::new(10, 20)); assert_eq!(rect.top_right, Point::new(30, 20)); assert_eq!(rect.bottom_left, Point::new(10, 40)); assert_eq!(rect.bottom_right, Point::new(30, 40)); assert_eq!(rect.size, Size::new(20, 20));
pub fn from_values(x: i32, y: i32, width: i32, height: i32) -> Rect[src]
Construct a Rect from its top-left corner and its size, values unwrapped.
Examples
assert_eq!(Rect::from_values(10, 20, 30, 40), Rect::from_size(Point::new(10, 20), Size::new(30, 40)));
pub fn from_point_values(
top_left_x: i32,
top_left_y: i32,
bottom_right_x: i32,
bottom_right_y: i32
) -> Rect[src]
top_left_x: i32,
top_left_y: i32,
bottom_right_x: i32,
bottom_right_y: i32
) -> Rect
Construct a Rect from its top-left and bottom-right corners, values unwrapped.
Examples
assert_eq!(Rect::from_point_values(10, 20, 30, 40), Rect::from_points(Point::new(10, 20), Point::new(30, 40)));
Trait Implementations
impl Clone for Rect[src]
fn clone(&self) -> Rect[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Copy for Rect[src]
impl Eq for Rect[src]
impl PartialEq<Rect> for Rect[src]
impl Debug for Rect[src]
impl Hash for Rect[src]
Auto Trait Implementations
Blanket Implementations
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,