[−][src]Struct sweeper::Clearing
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: (usize, usize)) -> 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) -> (usize, usize)
[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, (usize, usize)),
[src]
F: FnMut(&'f Field, (usize, usize)),
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, index: (usize, usize), 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]
fn from(op: ClearingMut<'f>) -> Self
[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,