Struct iced::Rectangle[][src]

pub struct Rectangle<T = f32> {
    pub x: T,
    pub y: T,
    pub width: T,
    pub height: T,
}

A rectangle.

Fields

x: T

X coordinate of the top-left corner.

y: T

Y coordinate of the top-left corner.

width: T

Width of the rectangle.

height: T

Height of the rectangle.

Implementations

impl Rectangle<f32>[src]

pub fn new(top_left: Point, size: Size<f32>) -> Rectangle<f32>[src]

Creates a new Rectangle with its top-left corner in the given Point and with the provided Size.

pub fn with_size(size: Size<f32>) -> Rectangle<f32>[src]

Creates a new Rectangle with its top-left corner at the origin and with the provided Size.

pub fn center(&self) -> Point[src]

Returns the Point at the center of the Rectangle.

pub fn center_x(&self) -> f32[src]

Returns the X coordinate of the Point at the center of the Rectangle.

pub fn center_y(&self) -> f32[src]

Returns the Y coordinate of the Point at the center of the Rectangle.

pub fn position(&self) -> Point[src]

Returns the position of the top left corner of the Rectangle.

pub fn size(&self) -> Size<f32>[src]

Returns the Size of the Rectangle.

pub fn contains(&self, point: Point) -> bool[src]

Returns true if the given Point is contained in the Rectangle.

pub fn intersection(&self, other: &Rectangle<f32>) -> Option<Rectangle<f32>>[src]

Computes the intersection with the given Rectangle.

pub fn snap(self) -> Rectangle<u32>[src]

Snaps the Rectangle to unsigned integer coordinates.

Trait Implementations

impl<T> Add<Vector<T>> for Rectangle<T> where
    T: Add<T, Output = T>, 
[src]

type Output = Rectangle<T>

The resulting type after applying the + operator.

impl<T> Clone for Rectangle<T> where
    T: Clone
[src]

impl<T> Copy for Rectangle<T> where
    T: Copy
[src]

impl<T> Debug for Rectangle<T> where
    T: Debug
[src]

impl<T> Default for Rectangle<T> where
    T: Default
[src]

impl<T> Eq for Rectangle<T> where
    T: Eq
[src]

impl From<Rectangle<u32>> for Rectangle<f32>[src]

impl Mul<f32> for Rectangle<f32>[src]

type Output = Rectangle<f32>

The resulting type after applying the * operator.

impl<T> PartialEq<Rectangle<T>> for Rectangle<T> where
    T: PartialEq<T>, 
[src]

impl<T> StructuralEq for Rectangle<T>[src]

impl<T> StructuralPartialEq for Rectangle<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Rectangle<T> where
    T: RefUnwindSafe

impl<T> Send for Rectangle<T> where
    T: Send

impl<T> Sync for Rectangle<T> where
    T: Sync

impl<T> Unpin for Rectangle<T> where
    T: Unpin

impl<T> UnwindSafe for Rectangle<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast<T> for T

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IsDefault for T where
    T: Default + PartialEq<T> + Copy
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Upcast<T> for T

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,