Trait ToSize2D

Source
pub trait ToSize2D<T> {
    // Required method
    fn to_size(self) -> Size2D<T>;
}
Expand description

A trait to aid in the ergonomics of creating a Size2D and usage of interfaces expecting Size2D.

§Examples

let size = size!(200, 400);

// We can pass another Size2D to this function
size.grow(size!(800, 400));

// But we can also pass a tuple
size.grow((400, 200));

Required Methods§

Source

fn to_size(self) -> Size2D<T>

Creates a new Size2D from self

§Examples
let size = (200, 100).to_size();

assert_eq!(size, size!(200, 100));

Implementations on Foreign Types§

Source§

impl<T> ToSize2D<T> for (T, T)
where T: Num + Copy,

Source§

fn to_size(self) -> Size2D<T>

Implementors§

Source§

impl<T> ToSize2D<T> for Size2D<T>