Struct mutils::Size[][src]

pub struct Size<N: Num = f32>(pub N, pub N);

Implementations

impl<N: Num> Size<N>[src]

pub fn width(&self) -> N[src]

pub fn height(&self) -> N[src]

pub fn set_width(&mut self, width: N)[src]

pub fn set_height(&mut self, height: N)[src]

pub fn area(&self) -> N[src]

The area of the size. Returns width * height.

pub fn index(&self, pos: Point<N>) -> N[src]

pub fn half(&self) -> Self[src]

pub fn to_point(self) -> Point<N>[src]

pub fn get_scale_diff(self, other: Self) -> Self[src]

impl<N: Num + Signed> Size<N>[src]

pub fn sign(&self) -> Self[src]

pub fn sign_exclusive_dir(&self) -> Self[src]

impl<N: Num> Size<N>[src]

pub fn to_clamped<T: Num + FromClamped<N>>(&self) -> Size<T>[src]

Converts to a new type. If the current values don't fit in the new type, then it'll be clamped between min and max. i.e. NumTuple::new(1 as i16, 1 as i16)::to::<u16>()

pub fn to<T: Num + From<N>>(&self) -> Size<T>[src]

This is to allow creating a new Size, with a new type, from the type given. i.e. Size::new(1 as u8, 1 as u8)::to::<u32>()

impl Size<f32>[src]

pub fn overlaps(self, Size(w, h): Self, xy1: Self, xy2: Self) -> bool[src]

pub fn floor(self) -> Self[src]

pub fn ceil(self) -> Self[src]

pub fn round(self) -> Self[src]

pub fn hypot(self) -> f32[src]

Trait Implementations

impl<N: Num> Add<Size<N>> for Point<N>[src]

type Output = Self

The resulting type after applying the + operator.

impl<N: Num> Add<Size<N>> for Rect<N>[src]

type Output = Self

The resulting type after applying the + operator.

impl<N: Num> Add<Size<N>> for Size<N>[src]

type Output = Self

The resulting type after applying the + operator.

impl<N: Num> AddAssign<Size<N>> for Point<N>[src]

impl<N: Num> AddAssign<Size<N>> for Rect<N>[src]

impl<N: Num> AddAssign<Size<N>> for Size<N>[src]

impl<N: Clone + Num> Clone for Size<N>[src]

impl<N: Copy + Num> Copy for Size<N>[src]

impl<N: Debug + Num> Debug for Size<N>[src]

impl<N: Num> Div<N> for Size<N>[src]

type Output = Self

The resulting type after applying the / operator.

impl<N: Num> Div<Size<N>> for Line<N>[src]

type Output = Self

The resulting type after applying the / operator.

impl<N: Num> Div<Size<N>> for Point<N>[src]

type Output = Self

The resulting type after applying the / operator.

impl<N: Num> Div<Size<N>> for Size<N>[src]

type Output = Self

The resulting type after applying the / operator.

impl<N: Num> DivAssign<Size<N>> for Line<N>[src]

impl<N: Num> DivAssign<Size<N>> for Point<N>[src]

impl<N: Num> DivAssign<Size<N>> for Size<N>[src]

impl<N: Num> From<(N, N)> for Size<N>[src]

fn from((x, y): (N, N)) -> Self[src]

(N, N) -> Size(N, N)

impl From<Size<f32>> for Transform[src]

impl<N: Num> Into<(N, N)> for Size<N>[src]

fn into(self) -> (N, N)[src]

Size(N, N) -> (N, N)

impl<N: Num> Mul<N> for Size<N>[src]

type Output = Self

The resulting type after applying the * operator.

impl<N: Num> Mul<Size<N>> for Line<N>[src]

type Output = Self

The resulting type after applying the * operator.

impl<N: Num> Mul<Size<N>> for Point<N>[src]

type Output = Self

The resulting type after applying the * operator.

impl<N: Num> Mul<Size<N>> for Size<N>[src]

type Output = Self

The resulting type after applying the * operator.

impl<N: Num> MulAssign<Size<N>> for Line<N>[src]

impl<N: Num> MulAssign<Size<N>> for Point<N>[src]

impl<N: Num> MulAssign<Size<N>> for Size<N>[src]

impl<N: Num + Signed> Neg for Size<N>[src]

type Output = Self

The resulting type after applying the - operator.

impl<N: Num> NumTuple<N> for Size<N>[src]

impl<N: Num> PartialEq<Size<N>> for Size<N>[src]

impl<N: Num> Rem<Size<N>> for Size<N>[src]

type Output = Self

The resulting type after applying the % operator.

impl<N: Num> Sub<Size<N>> for Point<N>[src]

type Output = Self

The resulting type after applying the - operator.

impl<N: Num> Sub<Size<N>> for Rect<N>[src]

type Output = Self

The resulting type after applying the - operator.

impl<N: Num> Sub<Size<N>> for Size<N>[src]

type Output = Self

The resulting type after applying the - operator.

impl<N: Num> SubAssign<Size<N>> for Point<N>[src]

impl<N: Num> SubAssign<Size<N>> for Rect<N>[src]

impl<N: Num> SubAssign<Size<N>> for Size<N>[src]

Auto Trait Implementations

impl<N> RefUnwindSafe for Size<N> where
    N: RefUnwindSafe
[src]

impl<N> Send for Size<N> where
    N: Send
[src]

impl<N> Sync for Size<N> where
    N: Sync
[src]

impl<N> Unpin for Size<N> where
    N: Unpin
[src]

impl<N> UnwindSafe for Size<N> where
    N: UnwindSafe
[src]

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> From<T> for T[src]

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

impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
    T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>, 
[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.