Struct grid_2d::Size [] [src]

pub struct Size { /* fields omitted */ }

A size cannot be created which would contain un-addressable cells. That is, the maximum size has a width and height of one greater than the maximum i32.

Methods

impl Size
[src]

[src]

Creates a new Size. Panics if x or y is greater than ::std::i32::MAX as u32 + 1.

[src]

Returns the width.

[src]

Returns the height.

[src]

Returns an iterator over all the coordinates within a rectangle of this size.

[src]

Suppose an array is used to implement a 2D grid of this size, where traversing the array from start to end is equivalent to traversing the 2D grid top to bottom, traversing left to right within each row. If a given coordinate is valid for such a grid, this function returns the index into the array corresponding to that coordinate.

[src]

[src]

Return the number of cells in a 2D grid of this size.

Trait Implementations

impl Debug for Size
[src]

[src]

Formats the value using the given formatter.

impl Clone for Size
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for Size
[src]

impl Hash for Size
[src]

[src]

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

1.3.0
[src]

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

impl PartialEq for Size
[src]

[src]

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

[src]

This method tests for !=.

impl Eq for Size
[src]

impl Default for Size
[src]

[src]

Returns the "default value" for a type. Read more

impl<T: Into<[u32; 2]>> From<T> for Size
[src]

[src]

Performs the conversion.

impl<T: Into<Size>> Add<T> for Size
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl Add<Coord> for Size
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl<T: Into<Size>> Sub<T> for Size
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl Sub<Coord> for Size
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.