Struct turtle::Size[][src]

pub struct Size {
    pub width: u32,
    pub height: u32,

Represents a size

A Size can be converted from either a tuple or array. These forms are often more ergonomic than using the Size struct on its own. The set_size() method accepts either form (without needing to use into()). See that method's documentation for more information.

assert_eq!(Size {width: 640, height: 480}, (640, 480).into());
assert_eq!(Size {width: 640, height: 480}, [640, 480].into());

You can access the width and height fields directly on any Size struct.

let size: Size = (800, 600).into();
assert_eq!(size.width, 800);
assert_eq!(size.height, 600);


The width in pixels

The height in pixels

Trait Implementations

impl Debug for Size

Formats the value using the given formatter. Read more

impl Clone for Size

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Size

impl PartialEq for Size

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Size

impl Hash for Size

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl From<(u32, u32)> for Size

Performs the conversion.

impl From<[u32; 2]> for Size

Performs the conversion.

Auto Trait Implementations

impl Send for Size

impl Sync for Size