[][src]Struct sweeper::Clearing

pub struct Clearing<'f> { /* fields omitted */ }

A clearing on the specified field.

This is merely a reference to the area on a field which is known to be a clearing. Nothing is owned by this structure.

Methods

impl<'f> Clearing<'f>[src]

pub fn new(field: &'f Field, anchor_location: FieldCoordinates) -> Option<Self>[src]

Returns a Clearing on the specified Field, or None if the location has 1 or more neighboring mines or is out of bounds.

pub fn field(self) -> &'f Field[src]

Returns the field on which this clearing is located.

pub fn anchor_location(self) -> FieldCoordinates[src]

Returns the location around which this clearing is formed.

This can be any location inside the clearing. More specifically, the one used during creation is returned.

pub fn for_every_tile<F>(self, include_shore: bool, f: F) where
    F: FnMut(&'f Field, FieldCoordinates), 
[src]

Executes the specified closure on every tile inside the clearing. Optionally can include the "shore" (tiles with numbers) as a part of the clearing.

The closure takes a reference to the field as the first argument and the location of the tile as the second one. No return value is expected.

#[must_use = "fully traversing a clearing is an expensive operation involving memory allocation"]pub fn size(self, include_shore: bool) -> NonZeroUsize[src]

Returns the size of the clearing, in tiles. Optionally can include the "shore" (tiles with numbers) as a part of the clearing.

#[must_use = "fully traversing a clearing is an expensive operation involving memory allocation"]pub fn includes(
    self,
    coordinates: FieldCoordinates,
    include_shore: bool
) -> bool
[src]

Returns true if the given tile is inside the clearing, false otherwise. Optionally can include the "shore" (tiles with numbers) as a part of the clearing.

Trait Implementations

impl<'f> Clone for Clearing<'f>[src]

impl<'f> Copy for Clearing<'f>[src]

impl<'f> From<ClearingMut<'f>> for Clearing<'f>[src]

Auto Trait Implementations

impl<'f> RefUnwindSafe for Clearing<'f>

impl<'f> Send for Clearing<'f>

impl<'f> Sync for Clearing<'f>

impl<'f> Unpin for Clearing<'f>

impl<'f> UnwindSafe for Clearing<'f>

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,