Trait figures::Rectlike[][src]

pub trait Rectlike<T, Unit>: Sized where
    T: Zero + PartialOrd + Mul<T, Output = T> + Sub<T, Output = T> + One + Add<T, Output = T> + Div<T, Output = T> + Copy
{
Show methods fn as_rect(&self) -> Rect<T, Unit>;
fn as_extents(&self) -> ExtentsRect<T, Unit>;
fn as_sized(&self) -> SizedRect<T, Unit>;
fn width(&self) -> Figure<T, Unit>;
fn height(&self) -> Figure<T, Unit>;
fn origin(&self) -> Point<T, Unit>;
fn translate<V: Into<Vector<T, Unit>>>(&self, by: V) -> Self;
fn inflate<V: Into<Vector<T, Unit>>>(&self, by: V) -> Self; fn to_non_empty(self) -> Option<Self> { ... }
fn is_empty(&self) -> bool { ... }
fn area(&self) -> Figure<T, Unit> { ... }
fn size(&self) -> Size<T, Unit> { ... }
fn center(&self) -> Point<T, Unit> { ... }
fn contains(&self, point: Point<T, Unit>) -> bool { ... }
fn intersection<R: Rectlike<T, Unit>>(
        &self,
        other: &R
    ) -> Option<ExtentsRect<T, Unit>> { ... }
fn union<R: Rectlike<T, Unit>>(
        &self,
        other: &R
    ) -> Option<ExtentsRect<T, Unit>> { ... }
}
Expand description

Functionalitiy that all rectangle types implement

Required methods

Returns this rectangle as a Rect. The rectangle’s underlying data will be unchanged by this operation.

Returns this rectangle converted to an ExtentsRect.

Returns this rectangle converted to a SizedRect.

Returns the width of the rectangle.

Returns the height of the rectangle.

Returns the origin of the rectangle.

Moves this rectangle by the vector provided.

Increases the size of this rectangle by the vector provided. The rectangle will grow around its center.

Provided methods

Checks to see if this rect is empty. If it is, None is returned. If it isn’t, the rect is returned unmodified.

Returns true if the rect doesn’t have a positive width and height.

Returns the area contained by this rectangle.

Returns the size of the rectangle.

Returns the center of the rectangle.

Returns true if point is within this rectangle.

Returns the intersecting area between the two rectangles. If the rectangles do not intersect, None is returned.

Returns the union of the two rectangles. If both rectangles aren’t empty, the smallest rectangle that both rectangles can fit into will be returned. If either rectangle is empty, the other rectangle is returned unmodified.

Implementors