Trait HasSize
pub trait HasSize<T = usize>where
T: Int,{
// Required method
fn size(&self) -> Size<T>;
// Provided methods
fn width(&self) -> T { ... }
fn height(&self) -> T { ... }
fn to_rect(&self) -> Rect<T> { ... }
}Expand description
Required Methods§
fn size(&self) -> Size<T>
fn size(&self) -> Size<T>
Returns the size of the object.
Provided Methods§
fn width(&self) -> T
fn width(&self) -> T
Returns the width of the object.
fn height(&self) -> T
fn height(&self) -> T
Returns the height of the object.
fn to_rect(&self) -> Rect<T>
fn to_rect(&self) -> Rect<T>
Returns a rectangle at Pos::ORIGIN where the size is the object’s size.
[Size] additionally provides an inherent const fn of the same name, and [Rect] the
equivalent [Rect::at_origin].