[][src]Struct conway::universe::Region

pub struct Region { /* fields omitted */ }

Rectangular area within a Universe.

Methods

impl Region[src]

A region is a rectangular area within a Universe. All coordinates are game coordinates.

pub fn new(left: isize, top: isize, width: usize, height: usize) -> Self[src]

Creates a new region given x and y coordinates of top-left corner, and width and height, all in units of cells (game coordinates). Width and height must both be positive.

pub fn left(&self) -> isize[src]

Returns the x coordinate of the leftmost cells of the Region, in game coordinates.

pub fn right(&self) -> isize[src]

Returns the x coordinate of the rightmost cells of the Region, in game coordinates.

pub fn top(&self) -> isize[src]

Returns the y coordinate of the uppermost cells of the Region, in game coordinates.

pub fn bottom(&self) -> isize[src]

Returns the y coordinate of the lowermost cells of the Region, in game coordinates.

pub fn width(&self) -> usize[src]

Returns the width of the Region (along x axis), in game coordinates.

pub fn height(&self) -> usize[src]

Returns the height of the Region (along y axis), in game coordinates.

pub fn contains(&self, col: isize, row: isize) -> bool[src]

Determines whether the specified cell is part of the Region.

pub fn intersection(&self, other: Region) -> Option<Region>[src]

Trait Implementations

impl PartialOrd<Region> for Region[src]

impl Copy for Region[src]

impl PartialEq<Region> for Region[src]

impl Clone for Region[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Ord for Region[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl Eq for Region[src]

impl Debug for Region[src]

Auto Trait Implementations

impl Send for Region

impl Sync for Region

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]