[][src]Struct iced_core::Rectangle

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) -> Self[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) -> Self[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[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<Output = T>, 
[src]

type Output = Rectangle<T>

The resulting type after applying the + operator.

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

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

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

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

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

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

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

type Output = Self

The resulting type after applying the * operator.

impl<T: PartialEq> PartialEq<Rectangle<T>> for Rectangle<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<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

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, U> ConvertInto<U> for T where
    U: ConvertFrom<T>, 
[src]

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

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

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.