pub trait ToSize2D<T> { // Required method fn to_size(self) -> Size2D<T>; }
A trait to aid in the ergonomics of creating a Size2D and usage of interfaces expecting Size2D.
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));
Creates a new Size2D from self
self
let size = (200, 100).to_size(); assert_eq!(size, size!(200, 100));