Type Alias Size

Source
pub type Size = Axes<Abs>;
Expand description

A size in 2D.

Aliased Type§

pub struct Size {
    pub x: Abs,
    pub y: Abs,
}

Fields§

§x: Abs

The horizontal component.

§y: Abs

The vertical component.

Implementations§

Source§

impl Size

Source

pub const fn zero() -> Self

The zero value.

Source

pub fn fits(self, other: Self) -> bool

Whether the other size fits into this one (smaller width and height).

Source

pub fn to_point(self) -> Point

Convert to a point.

Source

pub fn aspect_ratio(self) -> Ratio

Converts to a ratio of width to height.

Trait Implementations§

Source§

impl Add for Size

Source§

type Output = Axes<Abs>

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
Source§

impl AddAssign for Size

Source§

fn add_assign(&mut self, other: Size)

Performs the += operation. Read more
Source§

impl Div<f64> for Size

Source§

type Output = Axes<Abs>

The resulting type after applying the / operator.
Source§

fn div(self, other: f64) -> Self

Performs the / operation. Read more
Source§

impl DivAssign<f64> for Size

Source§

fn div_assign(&mut self, other: f64)

Performs the /= operation. Read more
Source§

impl Mul<f64> for Size

Source§

type Output = Axes<Abs>

The resulting type after applying the * operator.
Source§

fn mul(self, other: f64) -> Self

Performs the * operation. Read more
Source§

impl MulAssign<f64> for Size

Source§

fn mul_assign(&mut self, other: f64)

Performs the *= operation. Read more
Source§

impl Neg for Size

Source§

type Output = Axes<Abs>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl Numeric for Size

Source§

fn zero() -> Self

The identity element for addition.
Source§

fn is_finite(self) -> bool

Whether self consists only of finite parts.
Source§

fn is_zero(self) -> bool

Whether self is zero.
Source§

impl Sub for Size

Source§

type Output = Axes<Abs>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Size) -> Size

Performs the - operation. Read more
Source§

impl SubAssign for Size

Source§

fn sub_assign(&mut self, other: Size)

Performs the -= operation. Read more