[][src]Struct semeion::env::Neighborhood

pub struct Neighborhood<'a, 'e, K, C> { /* fields omitted */ }

The neighbor tiles of a specific Entity.

Implementations

impl<'a, 'e, K, C> Neighborhood<'a, 'e, K, C>[src]

pub fn dimension(&self) -> Dimension[src]

Gets the dimension of this neighborhood.

pub fn tiles(&self) -> impl Iterator<Item = &TileView<'a, 'e, K, C>>[src]

Gets an iterator over all the Tiles that belong to this Neighborhood.

pub fn tiles_mut(&mut self) -> impl Iterator<Item = &mut TileView<'a, 'e, K, C>>[src]

Gets an iterator over all the mutable Tiles that belong to this Neighborhood.

pub fn tile(&self, offset: impl Into<Offset>) -> &TileView<'a, 'e, K, C>[src]

Gets a reference to the Tile located at the given offset from the center of this Neighborhood.

The Neighborhood is seen as a Torus from this method, therefore, out of bounds offsets will be translated considering that the Neighborhood edges are joined.

pub fn tile_mut(
    &mut self,
    offset: impl Into<Offset>
) -> &mut TileView<'a, 'e, K, C>
[src]

Gets a mutable reference to the Tile located at the given offset from the center of this Neighborhood.

The Neighborhood is seen as a Torus from this method, therefore, out of bounds offsets will be translated considering that the Neighborhood edges are joined.

pub fn center(&self) -> &TileView<'a, 'e, K, C>[src]

Gets a reference to the Tile located in the center of this Neighborhood.

pub fn center_mut(&mut self) -> &mut TileView<'a, 'e, K, C>[src]

Gets a mutable reference to the Tile located in the center of this Neighborhood.

pub fn border(
    &self,
    offset: impl Into<Offset>,
    scope: impl Into<Scope>
) -> Option<Vec<&TileView<'a, 'e, K, C>>>
[src]

Gets a list of tiles that surround the Tile T of this Neighborhood, located at a given Offset from the center Tile, and according to the given Scope, that represents the distance from the Tile T.

The tiles are returned in arbitrary order. Returns None if any of the border tiles is beyond the Neighborhood dimension for the given Scope.

pub fn immediate_border(
    &self,
    scope: impl Into<Scope>
) -> Option<Vec<&TileView<'a, 'e, K, C>>>
[src]

Gets a list of tiles that surround the center Tile of this Neighborhood, and according to the given Scope, that represents the distance from the center Tile.

The tiles are returned in arbitrary order. Returns None if any of the border tiles is beyond the Neighborhood dimension for the given Scope.

impl<'a, 'e, K: PartialEq, C> Neighborhood<'a, 'e, K, C>[src]

pub fn contains_kind(&self, kind: K) -> bool[src]

Returns true only if any of the Tiles in this Neighborhood contains an Entity of the given Kind, without considering the Entity that is inspecting this Neighborhood.

Trait Implementations

impl<'a, 'e, K: Debug, C: Debug> Debug for Neighborhood<'a, 'e, K, C>[src]

impl<'a, 'e, K, C> From<Vec<TileView<'a, 'e, K, C>, Global>> for Neighborhood<'a, 'e, K, C>[src]

pub fn from(tiles: Vec<TileView<'a, 'e, K, C>>) -> Self[src]

Constructs a new Neighborhood from a list of tiles.

The list of tiles encodes a squared grid constructed top to bottom and left to right.

Auto Trait Implementations

impl<'a, 'e, K, C> !RefUnwindSafe for Neighborhood<'a, 'e, K, C>

impl<'a, 'e, K, C> !Send for Neighborhood<'a, 'e, K, C>

impl<'a, 'e, K, C> !Sync for Neighborhood<'a, 'e, K, C>

impl<'a, 'e, K, C> Unpin for Neighborhood<'a, 'e, K, C> where
    'e: 'a, 

impl<'a, 'e, K, C> !UnwindSafe for Neighborhood<'a, 'e, K, C>

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.