Rectangle

Struct Rectangle 

Source
pub struct Rectangle<T>
where T: Copy + Num + NumAssignOps + NumOps,
{ /* private fields */ }
Expand description

rectangle in 2D space with a width and height

Implementations§

Source§

impl<T> Rectangle<T>
where T: Copy + Num + NumAssignOps + NumOps + Float,

Source

pub fn round(&self) -> Self

Source§

impl<T> Rectangle<T>
where T: Copy + Num + NumAssignOps + NumOps,

A rectangle in 2D space constructor

Source

pub fn new(width: T, height: T) -> Self

Trait Implementations§

Source§

impl<T> Clone for Rectangle<T>
where T: Copy + Num + NumAssignOps + NumOps + Clone,

Source§

fn clone(&self) -> Rectangle<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for Rectangle<T>
where T: Copy + Num + NumAssignOps + NumOps + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> PartialEq for Rectangle<T>

Source§

fn eq(&self, other: &Rectangle<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> RectangleSize<T> for Rectangle<T>
where T: Copy + Num + NumAssignOps + NumOps,

A rectangle in 2D space with a width and height

Source§

fn width(&self) -> T

Source§

fn height(&self) -> T

Source§

impl<T> SizeForAxis<T> for Rectangle<T>
where T: Copy + Num + NumAssignOps + NumOps,

Source§

fn size_for_axis(&self, axis: Axis) -> T

Source§

impl<T> Copy for Rectangle<T>
where T: Copy + Num + NumAssignOps + NumOps + Copy,

Source§

impl<T> StructuralPartialEq for Rectangle<T>
where T: Copy + Num + NumAssignOps + NumOps,

Auto Trait Implementations§

§

impl<T> Freeze for Rectangle<T>
where T: Freeze,

§

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§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T, U> Dividing<T> for U
where U: QuarterRotation + VerticalDividingHelper<T>, T: Copy,

Source§

fn divide_vertical(&self, x: T) -> (U, U)

dividing a rectangle into two rectangles (vertical)
Source§

fn divide_horizontal(&self, y: T) -> (U, U)

dividing a rectangle into two rectangles (horizontal)
Source§

fn divide(&self, v: T, axis: Axis) -> (Self, Self)
where Self: Sized,

dividing a rectangle into two rectangles specified by axis
Source§

fn divide_by_values_and_axis(&self, values: &Vec<T>, axis: Axis) -> Vec<Self>
where Self: Sized + RectangleSize<T> + Clone, T: Copy + Num + NumAssignOps,

dividing a rectangle into specified number of rectangles specified by axis
Source§

fn divide_by_weights_and_axis(&self, weights: &[T], axis: Axis) -> Vec<Self>
where Self: Sized + RectangleSize<T> + Clone + SizeForAxis<T>, T: Copy + for<'a> Sum<&'a T> + Num + NumAssignOps + NumOps,

dividing a rectangle into specified weights of rectangles specified by axis
Source§

fn divide_vertical_then_horizontal_with_weights( &self, weights: &[T], aspect_ratio: T, boustrophedon: bool, ) -> Vec<Self>
where Self: Sized + RectangleSize<T> + Clone + SizeForAxis<T> + Area<T>, T: Copy + for<'a> Sum<&'a T> + Num + NumAssignOps + PartialOrd,

Source§

fn divide_horizontal_then_vertical_with_weights( &self, weights: &[T], aspect_ratio: T, boustrophedon: bool, ) -> Vec<Self>
where Self: Sized + RectangleSize<T> + Clone + SizeForAxis<T> + Area<T> + QuarterRotation, T: Copy + Num + NumOps + NumAssignOps + PartialOrd + for<'a> Sum<&'a T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.